这是CaiYouHui前端,一个关于flutter的安卓app,前端使用flutter实现

main.dart 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. import 'package:flutter/material.dart';
  2. import 'package:provider/provider.dart';
  3. import 'presentation/providers/auth_provider.dart';
  4. import 'presentation/providers/user_provider.dart';
  5. import 'presentation/navigation/app_router.dart';
  6. import 'injection_container.dart' as di;
  7. void main() async {
  8. WidgetsFlutterBinding.ensureInitialized();
  9. await di.init();
  10. runApp(const MyApp());
  11. }
  12. class MyApp extends StatelessWidget {
  13. const MyApp({super.key});
  14. // This widget is the root of your application.
  15. @override
  16. Widget build(BuildContext context) {
  17. return MultiProvider(
  18. providers: [
  19. ChangeNotifierProvider(create: (_) => di.sl<AuthProvider>()),
  20. ChangeNotifierProvider(create: (_) => di.sl<UserProvider>()),
  21. ],
  22. child: MaterialApp(
  23. title: 'Flutter App',
  24. theme: ThemeData(
  25. primarySwatch: Colors.blue,
  26. // fontFamily: 'Roboto',
  27. appBarTheme: const AppBarTheme(
  28. backgroundColor: Colors.white,
  29. foregroundColor: Colors.black,
  30. elevation: 0,
  31. centerTitle: true,
  32. ),
  33. scaffoldBackgroundColor: Colors.white,
  34. bottomNavigationBarTheme: const BottomNavigationBarThemeData(
  35. backgroundColor: Colors.white,
  36. selectedItemColor: Colors.blue,
  37. unselectedItemColor: Colors.grey,
  38. showUnselectedLabels: true,
  39. ),
  40. ),
  41. debugShowCheckedModeBanner: false,
  42. initialRoute: '/',
  43. onGenerateRoute: AppRouter.onGenerateRoute,
  44. ),
  45. );
  46. }
  47. }