Copy old project - initial state
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
import 'package:get/get.dart';
|
||||
import 'package:terepi_seged/pages/start/presentation/controllers/start_page_controller.dart';
|
||||
|
||||
class StartPageBinding extends Bindings {
|
||||
@override
|
||||
void dependencies() {
|
||||
Get.put<StartPageController>(StartPageController());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
import 'dart:developer';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
import 'package:terepi_seged/routes/app_pages.dart';
|
||||
|
||||
class StartPageController extends GetxController {
|
||||
late PermissionStatus bluetoothStatus;
|
||||
late Directory? applicationDocumentDirectory;
|
||||
late Directory? applicationSupportDirectory;
|
||||
late List<Directory>? externalCacheDirectories;
|
||||
late Directory? externalStorageDirectory;
|
||||
late Directory? temporaryDirectory;
|
||||
late List<Directory>? externalStorageDirectoriesDocuments;
|
||||
|
||||
@override
|
||||
void onInit() async {
|
||||
applicationDocumentDirectory = await getApplicationDocumentsDirectory();
|
||||
applicationSupportDirectory = await getApplicationSupportDirectory();
|
||||
externalCacheDirectories = await getExternalCacheDirectories();
|
||||
externalStorageDirectory = await getExternalStorageDirectory();
|
||||
temporaryDirectory = await getTemporaryDirectory();
|
||||
externalStorageDirectoriesDocuments =
|
||||
await getExternalStorageDirectories(type: StorageDirectory.documents);
|
||||
|
||||
if (applicationDocumentDirectory != null) {
|
||||
log("ApplicationDocumentsDirectory: ${applicationDocumentDirectory?.path}");
|
||||
String pointsPath = '${applicationDocumentDirectory!.path}/Points/';
|
||||
bool pointsPathIsExits = await Directory(pointsPath).exists();
|
||||
if (!pointsPathIsExits) {
|
||||
await Directory(pointsPath).create(recursive: true);
|
||||
}
|
||||
File dataFile = File("$pointsPath/data.txt");
|
||||
DateTime now = DateTime.now();
|
||||
String contents =
|
||||
"Start: ${DateFormat('kk:mm:ss \n EEE d MMM').format(now)} \r\n";
|
||||
await dataFile.writeAsString(contents, mode: FileMode.append);
|
||||
log(contents);
|
||||
} else {
|
||||
log("ApplicationDocumentsDirectory: ---- NO ----}");
|
||||
}
|
||||
if (applicationSupportDirectory != null) {
|
||||
log("applicationSupportDirectory: ${applicationSupportDirectory?.path}");
|
||||
} else {
|
||||
log("applicationSupportDirectory: ---- NO ----}");
|
||||
}
|
||||
if (externalCacheDirectories!.isNotEmpty) {
|
||||
log("externalCacheDirectories: ${externalCacheDirectories!.length}");
|
||||
for (var externalCacheDirectory in externalCacheDirectories!) {
|
||||
log(" - externalCacheDirectories: ${externalCacheDirectory.path}");
|
||||
}
|
||||
} else {
|
||||
log("externalCacheDirectories: ---- NO ----}");
|
||||
}
|
||||
if (externalStorageDirectory != null) {
|
||||
print("externalStorageDirectory: ${externalStorageDirectory?.path}");
|
||||
String pointsPath = '${externalStorageDirectory!.path}/Points/';
|
||||
bool pointsPathIsExits = await Directory(pointsPath).exists();
|
||||
if (!pointsPathIsExits) {
|
||||
await Directory(pointsPath).create(recursive: true);
|
||||
}
|
||||
File dataFile = File("$pointsPath/data.txt");
|
||||
DateTime now = DateTime.now();
|
||||
String contents =
|
||||
"Start: ${DateFormat('kk:mm:ss \n EEE d MMM').format(now)} \r\n";
|
||||
await dataFile.writeAsString(contents, mode: FileMode.append);
|
||||
print(contents);
|
||||
} else {
|
||||
log("externalStorageDirectory: ---- NO ----}");
|
||||
}
|
||||
if (temporaryDirectory != null) {
|
||||
log("temporaryDirectory: ${temporaryDirectory?.path}");
|
||||
} else {
|
||||
log("temporaryDirectory: ---- NO ----}");
|
||||
}
|
||||
if (externalStorageDirectoriesDocuments!.isNotEmpty) {
|
||||
log("externalStorageDirectoriesDocuments: ${externalStorageDirectoriesDocuments!.length}");
|
||||
for (var externalStorageDirectoryDocuments
|
||||
in externalStorageDirectoriesDocuments!) {
|
||||
log(" - externalCacheDirectories: ${externalStorageDirectoryDocuments.path}");
|
||||
}
|
||||
} else {
|
||||
log("externalStorageDirectoriesDocuments: ---- NO ----}");
|
||||
}
|
||||
|
||||
super.onInit();
|
||||
}
|
||||
|
||||
@override
|
||||
void onReady() async {
|
||||
super.onReady();
|
||||
bluetoothStatus = await Permission.bluetooth.status;
|
||||
_departStartPage();
|
||||
}
|
||||
|
||||
void _departStartPage() async {
|
||||
await Future.delayed(const Duration(seconds: 5));
|
||||
Get.offAllNamed(Routes.HOME);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
import 'package:animated_text_kit/animated_text_kit.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:terepi_seged/pages/start/presentation/controllers/start_page_controller.dart';
|
||||
|
||||
class StartPage extends GetView<StartPageController> {
|
||||
const StartPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.white54,
|
||||
body: Center(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const Text('Terepi',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 32.0,
|
||||
fontWeight: FontWeight.normal,
|
||||
letterSpacing: 1.15)),
|
||||
const SizedBox(
|
||||
width: 8.0,
|
||||
),
|
||||
DefaultTextStyle(
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 32,
|
||||
fontWeight: FontWeight.normal,
|
||||
letterSpacing: 1.15),
|
||||
child: AnimatedTextKit(
|
||||
animatedTexts: [
|
||||
TypewriterAnimatedText('Segéd',
|
||||
speed: const Duration(milliseconds: 350), cursor: '')
|
||||
],
|
||||
isRepeatingAnimation: false,
|
||||
))
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user