| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- import 'package:flutter/material.dart';
- import 'package:get/get.dart';
- import '../service/all_init.dart';
- import '../service/api.dart' as api;
- import 'home/home_view.dart';
- import 'login/login_view.dart';
- class InitView extends StatefulWidget{
- const InitView({super.key});
- @override
- State<StatefulWidget> createState() {
- return _State();
- }
- }
- class _State extends State<InitView>{
- @override
- Widget build(BuildContext context) {
- return const Scaffold(body: Center());
- }
- void init()async{
- await allInit();
- await 1.seconds.delay();
- try{
- await api.ApiService.to.stub.toMapListV2(api.MapListRequestV2());
- Get.offAll(()=>const HomeView(), binding: HomeView.bindings());
- }catch(e){
- LoginView.to(canBack: false, thenToPageCall: (){
- Get.offAll(()=>const HomeView(), binding: HomeView.bindings());
- });
- }
- }
- @override
- void initState() {
- super.initState();
- init();
- }
- }
|