main.dart 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter_habit/provider/ConfigProvider.dart';
  3. import 'package:flutter_habit/provider/DataProvider.dart';
  4. import 'package:flutter_habit/provider/UserProvider.dart';
  5. import 'package:flutter_habit/pages/splash_page.dart';
  6. import 'package:provider/provider.dart';
  7. import 'provider/NotificationProvider.dart';
  8. import '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: 'Habit',
  38. debugShowCheckedModeBanner: false,
  39. theme: ThemeData(
  40. primarySwatch: Provider.of<ThemeProvider>(context).currentMaterialColor,
  41. brightness: Provider.of<ThemeProvider>(context).currentBrightness,
  42. ),
  43. home: LoadingPage(),
  44. );
  45. }
  46. }