Preclean
This commit is contained in:
23
web_native/lib/blocs/theme/bloc.dart
Normal file
23
web_native/lib/blocs/theme/bloc.dart
Normal file
@@ -0,0 +1,23 @@
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:imagini/blocs/theme/events.dart';
|
||||
import 'package:imagini/blocs/theme/state.dart';
|
||||
import 'package:imagini/settings/app_themes.dart';
|
||||
|
||||
class ThemeBloc extends Bloc<ThemeEvent, ThemeState> {
|
||||
//
|
||||
ThemeBloc()
|
||||
: super(
|
||||
ThemeState(
|
||||
themeData: AppThemes.appThemeData[AppTheme.lightTheme],
|
||||
),
|
||||
);
|
||||
|
||||
@override
|
||||
Stream<ThemeState> mapEventToState(ThemeEvent event) async* {
|
||||
if (event is ThemeEvent) {
|
||||
yield ThemeState(
|
||||
themeData: AppThemes.appThemeData[event.appTheme],
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
6
web_native/lib/blocs/theme/events.dart
Normal file
6
web_native/lib/blocs/theme/events.dart
Normal file
@@ -0,0 +1,6 @@
|
||||
import 'package:imagini/settings/app_themes.dart';
|
||||
|
||||
class ThemeEvent {
|
||||
final AppTheme appTheme;
|
||||
ThemeEvent({this.appTheme});
|
||||
}
|
||||
6
web_native/lib/blocs/theme/state.dart
Normal file
6
web_native/lib/blocs/theme/state.dart
Normal file
@@ -0,0 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class ThemeState {
|
||||
final ThemeData themeData;
|
||||
ThemeState({this.themeData});
|
||||
}
|
||||
Reference in New Issue
Block a user