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.
59 lines
1.5 KiB
59 lines
1.5 KiB
|
|
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 '../providers/user_provider.dart';
|
|
|
|
|
|
|
|
class Loading extends StatefulWidget {
|
|
const Loading({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
_LoadingState createState() => _LoadingState();
|
|
}
|
|
|
|
class _LoadingState extends State<Loading> {
|
|
// Future initialAll() async {
|
|
//
|
|
// }
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
final userProvider = Provider.of<UserProvider>(context, listen: false);
|
|
Future.delayed(const Duration(milliseconds: 1000), () async {
|
|
// await initialAll();
|
|
if (!await userProvider.init()) {
|
|
// await Get.offAll(() => const LoginPage());
|
|
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),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|