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 { // Future initialAll() async { // // } @override void initState() { super.initState(); final userProvider = Provider.of(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), ), ], ), ); } }