| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- import 'package:flutter/material.dart';
- import 'package:provider/provider.dart';
- import 'core/constants/route_constants.dart';
- import 'presentation/providers/auth_provider.dart';
- import 'presentation/providers/user_provider.dart';
- import 'presentation/navigation/app_router.dart';
- import 'injection_container.dart' as di;
-
- void main() async {
- WidgetsFlutterBinding.ensureInitialized();
- await di.init(); // 初始化DI容器
- runApp(const MyApp());
- }
-
- class MyApp extends StatelessWidget {
- const MyApp({super.key});
-
- // This widget is the root of your application.
- @override
- Widget build(BuildContext context) {
- return MultiProvider(
- providers: [
- ChangeNotifierProvider(create: (_) => di.sl<AuthProvider>()),
- ChangeNotifierProvider(create: (_) => di.sl<UserProvider>()),
- ],
- child: MaterialApp(
- title: '中了么',
- theme: ThemeData(
- primarySwatch: Colors.blue,
- // fontFamily: 'Roboto',
- appBarTheme: const AppBarTheme(
- backgroundColor: Colors.white,
- foregroundColor: Colors.black,
- elevation: 0,
- centerTitle: true,
- ),
- scaffoldBackgroundColor: Colors.white,
- bottomNavigationBarTheme: const BottomNavigationBarThemeData(
- backgroundColor: Colors.white,
- selectedItemColor: Colors.blue,
- unselectedItemColor: Colors.grey,
- showUnselectedLabels: true,
- ),
- ),
- debugShowCheckedModeBanner: false,
- initialRoute: RouteConstants.splash,
- onGenerateRoute: AppRouter.onGenerateRoute,
- ),
- );
- }
- }
|