import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:imagini/services/api/api.dart'; import 'package:imagini/screens/login.dart'; import 'package:imagini/blocs/login/bloc.dart'; import 'package:imagini/settings/preferences.dart'; import 'package:imagini/blocs/theme/bloc.dart'; import 'package:imagini/blocs/theme/state.dart'; void main() async { WidgetsFlutterBinding.ensureInitialized(); await Preferences.init(); runApp(ImaginiApp()); } class ImaginiApp extends StatelessWidget { @override Widget build(BuildContext context) { return BlocProvider( create: (context) => ThemeBloc(), child: BlocBuilder(builder: (BuildContext context, ThemeState themeState) { return MaterialApp( title: 'Imagini', debugShowCheckedModeBanner: false, theme: themeState.themeData, home: BlocProvider( // create: (context) => LoginBloc(albumsRepo: AlbumServices()), create: (context) => LoginBloc(imaginiAPI: ImaginiAPI()), child: LoginScreen(), ), ); }, ), ); } }