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.

67 lines
1.8 KiB

import 'package:flutter/foundation.dart';
2 years ago
import 'package:flutter/material.dart';
import 'package:project_telephony/ui/tab_navigator.dart';
2 years ago
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';
2 years ago
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();
}
2 years ago
@override
void initState() {
super.initState();
final userProvider = Provider.of<UserProvider>(context, listen: false);
2 years ago
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 {
2 years ago
Navigator.of(context).pushReplacementNamed("/TabNavigator");
2 years ago
// await Get.offAll(() => const TabNavigator());
}
});
2 years ago
}
@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),),
],
));
2 years ago
}}