main.dart 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter_habit/common/provider/ConfigProvider.dart';
  3. import 'package:flutter_habit/common/provider/DataProvider.dart';
  4. import 'package:flutter_habit/common/provider/UserProvider.dart';
  5. import 'package:flutter_habit/view/LoadingPage.dart';
  6. import 'package:provider/provider.dart';
  7. import 'common/provider/NotificationProvider.dart';
  8. import 'common/provider/ThemeProvider.dart';
  9. void main() {
  10. runApp(
  11. MultiProvider(
  12. providers: [
  13. ChangeNotifierProvider<ThemeProvider>(
  14. create: (_) => ThemeProvider(),
  15. ),
  16. ChangeNotifierProvider<UserProvider>(
  17. create: (_) => UserProvider(),
  18. ),
  19. ChangeNotifierProvider<DataProvider>(
  20. create: (_) => DataProvider(),
  21. ),
  22. ChangeNotifierProvider<ConfigProvider>(
  23. create: (_) => ConfigProvider(),
  24. ),
  25. ChangeNotifierProvider<NotificationProvider>(
  26. create: (_) => NotificationProvider(),
  27. ),
  28. ],
  29. child: MyApp(),
  30. ),
  31. );
  32. }
  33. class MyApp extends StatelessWidget {
  34. @override
  35. Widget build(BuildContext context) {
  36. return MaterialApp(
  37. title: 'Flutter Demo',
  38. theme: ThemeData(
  39. primarySwatch: Provider.of<ThemeProvider>(context).currentMaterialColor,
  40. brightness: Provider.of<ThemeProvider>(context).currentBrightness,
  41. ),
  42. // home: LoadingPage(),
  43. home: LoadingPage(),
  44. );
  45. }
  46. }