Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class App extends StatefulWidget {
- final WeatherRepository weatherRepository;
- App({Key key, @required this.weatherRepository})
- : assert(weatherRepository != null),
- super(key: key);
- @override
- State<App> createState() => _AppState();
- }
- class _AppState extends State<App> {
- ThemeBloc _themeBloc = ThemeBloc();
- SettingsBloc _settingsBloc = SettingsBloc();
- @override
- Widget build(BuildContext context) {
- return BlocProvider(
- bloc: _themeBloc,
- child: BlocProvider(
- bloc: _settingsBloc,
- child: BlocBuilder(
- bloc: _themeBloc,
- builder: (_, ThemeState themeState) {
- return MaterialApp(
- title: 'Flutter Demo',
- theme: themeState.theme,
- home: Weather(
- weatherRepository: widget.weatherRepository,
- ),
- );
- },
- ),
- ),
- );
- }
- @override
- void dispose() {
- _themeBloc.dispose();
- _settingsBloc.dispose();
- super.dispose();
- }
- }
Add Comment
Please, Sign In to add comment