daily pastebin goal
31%
SHARE
TWEET

Untitled

a guest Feb 12th, 2019 50 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class App extends StatefulWidget {
  2.   final WeatherRepository weatherRepository;
  3.  
  4.   App({Key key, @required this.weatherRepository})
  5.       : assert(weatherRepository != null),
  6.         super(key: key);
  7.  
  8.   @override
  9.   State<App> createState() => _AppState();
  10. }
  11.  
  12. class _AppState extends State<App> {
  13.   ThemeBloc _themeBloc = ThemeBloc();
  14.   SettingsBloc _settingsBloc = SettingsBloc();
  15.  
  16.   @override
  17.   Widget build(BuildContext context) {
  18.     return BlocProvider(
  19.       bloc: _themeBloc,
  20.       child: BlocProvider(
  21.         bloc: _settingsBloc,
  22.         child: BlocBuilder(
  23.           bloc: _themeBloc,
  24.           builder: (_, ThemeState themeState) {
  25.             return MaterialApp(
  26.               title: 'Flutter Demo',
  27.               theme: themeState.theme,
  28.               home: Weather(
  29.                 weatherRepository: widget.weatherRepository,
  30.               ),
  31.             );
  32.           },
  33.         ),
  34.       ),
  35.     );
  36.   }
  37.  
  38.   @override
  39.   void dispose() {
  40.     _themeBloc.dispose();
  41.     _settingsBloc.dispose();
  42.     super.dispose();
  43.   }
  44. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top