This repository has been archived on 2023-11-13. You can view files and clone it, but cannot push or open issues or pull requests.
imagini/web_native/lib/main.dart
2021-01-23 19:28:26 -05:00

39 lines
1.2 KiB
Dart

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<ThemeBloc, ThemeState>(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(),
),
);
},
),
);
}
}