24 lines
615 B
Dart
24 lines
615 B
Dart
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],
|
|
);
|
|
}
|
|
}
|
|
}
|