You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
1.8 KiB

import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:project_telephony/ui/tab_navigator.dart';
import 'dart:async';
import 'package:project_telephony/utils/headers.dart';
import 'package:provider/provider.dart';
import '../constants/environment/environment.dart';
import '../providers/user_provider.dart';
import '../utils/hive_store.dart';
import 'login/login_page.dart';
class Loading extends StatefulWidget {
Loading({Key? key}) : super(key: key);
@override
_LoadingState createState() => _LoadingState();
}
class _LoadingState extends State<Loading> {
Future initialAll() async {
await HiveStore.init();
}
@override
void initState() {
super.initState();
final userProvider = Provider.of<UserProvider>(context, listen: false);
var env = const String.fromEnvironment('ENV', defaultValue: 'dev');
if (kDebugMode) {
print('env :$env');
}
DevEV.instance.setEnvironment(
context,
environment: env == 'dev',
);
Future.delayed(const Duration(milliseconds: 1000), () async {
await initialAll();
if (!await userProvider.init()) {
await Get.offAll(() => const TabNavigator());
// await Get.offAll(() => const LoginPage());
} else {
Navigator.of(context).pushReplacementNamed("/TabNavigator");
// await Get.offAll(() => const TabNavigator());
}
});
}
@override
Widget build(BuildContext context) {
//启动图片
return Scaffold(
backgroundColor: Colors.white,
body: Stack(
children: [
Positioned(
bottom: 158.w,
left: 143.w,
child: Image.asset(Assets.images.start.path,
width: 434.sp, height: 148.sp, fit: BoxFit.fill),
),
],
),
);
}
}