update new features and flutter 3.13
This commit is contained in:
@ -1,4 +1,3 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_map_tile_caching/flutter_map_tile_caching.dart';
|
||||
import 'package:get/get.dart';
|
||||
@ -6,33 +5,32 @@ import 'package:rogapp/pages/destination/destination_controller.dart';
|
||||
import 'package:rogapp/pages/index/index_binding.dart';
|
||||
import 'package:rogapp/routes/app_pages.dart';
|
||||
import 'package:rogapp/utils/string_values.dart';
|
||||
import 'package:is_lock_screen/is_lock_screen.dart';
|
||||
// import 'package:is_lock_screen/is_lock_screen.dart';
|
||||
|
||||
void main() async {
|
||||
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
|
||||
FlutterMapTileCaching.initialise(await RootDirectory.normalCache);
|
||||
|
||||
await FlutterMapTileCaching.initialise();
|
||||
final StoreDirectory instanceA = FMTC.instance('OpenStreetMap (A)');
|
||||
await instanceA.manage.createAsync();
|
||||
await instanceA.metadata.addAsync(
|
||||
key: 'sourceURL',
|
||||
value: 'https://cyberjapandata.gsi.go.jp/xyz/std/{z}/{x}/{y}.png',
|
||||
);
|
||||
await instanceA.metadata.addAsync(
|
||||
key: 'validDuration',
|
||||
value: '14',
|
||||
);
|
||||
await instanceA.metadata.addAsync(
|
||||
key: 'behaviour',
|
||||
value: 'cacheFirst',
|
||||
);
|
||||
await instanceA.manage.createAsync();
|
||||
await instanceA.metadata.addAsync(
|
||||
key: 'sourceURL',
|
||||
value: 'https://cyberjapandata.gsi.go.jp/xyz/std/{z}/{x}/{y}.png',
|
||||
);
|
||||
await instanceA.metadata.addAsync(
|
||||
key: 'validDuration',
|
||||
value: '14',
|
||||
);
|
||||
await instanceA.metadata.addAsync(
|
||||
key: 'behaviour',
|
||||
value: 'cacheFirst',
|
||||
);
|
||||
|
||||
runApp(const MyApp());
|
||||
}
|
||||
|
||||
class MyApp extends StatefulWidget {
|
||||
const MyApp({Key? key}) : super(key: key);
|
||||
const MyApp({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<MyApp> createState() => _MyAppState();
|
||||
@ -44,22 +42,38 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
WidgetsBinding.instance?.addObserver(this);
|
||||
WidgetsBinding.instance.addObserver(this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@override
|
||||
void didChangeAppLifecycleState(AppLifecycleState state) async {
|
||||
super.didChangeAppLifecycleState(state);
|
||||
if (state == AppLifecycleState.inactive) {
|
||||
print('app inactive, is lock screen: ${await isLockScreen()}');
|
||||
} else if (state == AppLifecycleState.resumed) {
|
||||
DestinationController destinationController = Get.find<DestinationController>();
|
||||
destinationController.initGPS();
|
||||
print('app resumed');
|
||||
}
|
||||
void dispose() {
|
||||
WidgetsBinding.instance.removeObserver(this);
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
void didChangeAppLifecycleState(AppLifecycleState state) {
|
||||
switch (state) {
|
||||
case AppLifecycleState.resumed:
|
||||
print("RESUMED");
|
||||
DestinationController destinationController = Get.find<DestinationController>();
|
||||
destinationController.initGPS();
|
||||
break;
|
||||
case AppLifecycleState.inactive:
|
||||
print("INACTIVE");
|
||||
break;
|
||||
case AppLifecycleState.paused:
|
||||
print("PAUSED");
|
||||
break;
|
||||
case AppLifecycleState.detached:
|
||||
print("DETACHED");
|
||||
break;
|
||||
case AppLifecycleState.hidden:
|
||||
print("DETACHED");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -70,8 +84,9 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
|
||||
fallbackLocale: const Locale('en', 'US'),
|
||||
title: 'ROGAINING',
|
||||
theme: ThemeData(
|
||||
primarySwatch: Colors.blue,
|
||||
visualDensity: VisualDensity.adaptivePlatformDensity,
|
||||
colorScheme:
|
||||
ColorScheme.fromSeed(seedColor: Color.fromARGB(255, 36, 135, 221)),
|
||||
useMaterial3: true,
|
||||
),
|
||||
debugShowCheckedModeBanner: false,
|
||||
defaultTransition: Transition.cupertino,
|
||||
|
||||
Reference in New Issue
Block a user