|
|
@ -2,9 +2,12 @@ import 'package:akuCommunity/pages/tab_navigator.dart';
|
|
|
|
import 'package:akuCommunity/provider/user_provider.dart';
|
|
|
|
import 'package:akuCommunity/provider/user_provider.dart';
|
|
|
|
import 'package:akuCommunity/utils/hive_store.dart';
|
|
|
|
import 'package:akuCommunity/utils/hive_store.dart';
|
|
|
|
import 'package:akuCommunity/utils/logger/logger_view.dart';
|
|
|
|
import 'package:akuCommunity/utils/logger/logger_view.dart';
|
|
|
|
|
|
|
|
import 'package:amap_location_fluttify/amap_location_fluttify.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
import 'package:get/get.dart';
|
|
|
|
import 'package:get/get.dart';
|
|
|
|
|
|
|
|
import 'package:hive/hive.dart';
|
|
|
|
|
|
|
|
import 'package:hive_flutter/hive_flutter.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
import 'package:velocity_x/velocity_x.dart';
|
|
|
|
import 'package:velocity_x/velocity_x.dart';
|
|
|
|
|
|
|
|
|
|
|
@ -17,8 +20,21 @@ class SplashPage extends StatefulWidget {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class _SplashPageState extends State<SplashPage> {
|
|
|
|
class _SplashPageState extends State<SplashPage> {
|
|
|
|
|
|
|
|
///原生端耗时加载
|
|
|
|
|
|
|
|
Future _originOp() async {
|
|
|
|
|
|
|
|
//初始化HiveStore
|
|
|
|
|
|
|
|
await Hive.initFlutter();
|
|
|
|
|
|
|
|
await HiveStore.init();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//初始化AMap
|
|
|
|
|
|
|
|
AmapLocation.instance.init(iosKey: 'ios key');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Future _initOp() async {
|
|
|
|
Future _initOp() async {
|
|
|
|
|
|
|
|
//ensure call _originOp first.
|
|
|
|
|
|
|
|
await _originOp();
|
|
|
|
final userProvider = Provider.of<UserProvider>(context, listen: false);
|
|
|
|
final userProvider = Provider.of<UserProvider>(context, listen: false);
|
|
|
|
|
|
|
|
//app init delay 2 second
|
|
|
|
await Future.delayed(Duration(seconds: 2));
|
|
|
|
await Future.delayed(Duration(seconds: 2));
|
|
|
|
if (HiveStore.appBox.get('login') ?? false) {
|
|
|
|
if (HiveStore.appBox.get('login') ?? false) {
|
|
|
|
await userProvider.setLogin(HiveStore.appBox.get('token'));
|
|
|
|
await userProvider.setLogin(HiveStore.appBox.get('token'));
|
|
|
|