import 'package:flutter/material.dart';
import 'package:flutter_habit/common/provider/ConfigProvider.dart';
import 'package:flutter_habit/common/provider/DataProvider.dart';
import 'package:flutter_habit/common/provider/UserProvider.dart';
import 'package:flutter_habit/view/LoadingPage.dart';
import 'package:provider/provider.dart';

import 'common/provider/NotificationProvider.dart';
import 'common/provider/ThemeProvider.dart';

void main() {
  runApp(
    MultiProvider(
      providers: [
        ChangeNotifierProvider<ThemeProvider>(
          create: (_) => ThemeProvider(),
        ),
        ChangeNotifierProvider<UserProvider>(
          create: (_) => UserProvider(),
        ),
        ChangeNotifierProvider<DataProvider>(
          create: (_) => DataProvider(),
        ),
        ChangeNotifierProvider<ConfigProvider>(
          create: (_) => ConfigProvider(),
        ),
        ChangeNotifierProvider<NotificationProvider>(
          create: (_) => NotificationProvider(),
        ),
      ],
      child: MyApp(),
    ),
  );
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Provider.of<ThemeProvider>(context).currentMaterialColor,
        brightness: Provider.of<ThemeProvider>(context).currentBrightness,
      ),
//      home: LoadingPage(),
      home: LoadingPage(),
    );
  }
}
