1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- import 'package:flutter/material.dart';
- import 'package:flutter_screenutil/flutter_screenutil.dart';
- import 'package:flutter_tracker/pages/welcome_page.dart';
- import 'package:flutter_tracker/routes/routes.dart';
- import 'package:shared_preferences/shared_preferences.dart';
- import 'index_page.dart';
- import 'model/config.dart';
- /// Description:
- /// Time : 2021年12月03日 Friday
- /// Author : liuyuqi.gov@msncn
- void main() async {
- WidgetsFlutterBinding.ensureInitialized();
- Config.initConfig();
- SharedPreferences sharedPreferences = await SharedPreferences.getInstance();
- bool isLogin = sharedPreferences.getBool("isLogin");
- isLogin ??= false;
- runApp(MyApp(
- isLogin: isLogin,
- ));
- }
- class MyApp extends StatelessWidget {
- bool isLogin = false;
- MyApp({Key key, this.isLogin}) : super(key: key);
- // This widget is the root of your application.
- @override
- Widget build(BuildContext context) {
- return ScreenUtilInit(
- designSize: const Size(750, 1344),
- builder: () => MaterialApp(
- title: '追踪者',
- theme: ThemeData(
- primarySwatch: Colors.blue,
- ),
- debugShowCheckedModeBanner: false,
- home: isLogin ? IndexPage() : WelComePage(),
- onGenerateRoute: Routes.generateRoute,
- ),
- );
- }
- }
|