forked from eatvio/eatvio_app
refactor(token): add token storage, remove hive
This commit is contained in:
@@ -1,20 +0,0 @@
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../core/app_export.dart';
|
||||
|
||||
part 'theme_event.dart';
|
||||
part 'theme_state.dart';
|
||||
|
||||
class ThemeBloc extends Bloc<ThemeEvent, ThemeState> {
|
||||
ThemeBloc(ThemeState initialState) : super(initialState) {
|
||||
on<ThemeChangeEvent>(_changeTheme);
|
||||
}
|
||||
|
||||
_changeTheme(
|
||||
ThemeChangeEvent event,
|
||||
Emitter<ThemeState> emit,
|
||||
) async {
|
||||
emit(state.copyWith(themeType: event.themeType));
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
part of 'theme_bloc.dart';
|
||||
|
||||
@immutable
|
||||
abstract class ThemeEvent extends Equatable {}
|
||||
|
||||
class ThemeChangeEvent extends ThemeEvent {
|
||||
ThemeChangeEvent({required this.themeType}) : super() {
|
||||
PrefUtils().setThemeData(themeType);
|
||||
}
|
||||
|
||||
final String themeType;
|
||||
|
||||
@override
|
||||
List<Object?> get props => [];
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
part of 'theme_bloc.dart';
|
||||
|
||||
@immutable
|
||||
class ThemeState extends Equatable {
|
||||
ThemeState({required this.themeType});
|
||||
|
||||
final String themeType;
|
||||
|
||||
@override
|
||||
List<Object?> get props => [themeType];
|
||||
|
||||
ThemeState copyWith({String? themeType}) {
|
||||
return ThemeState(themeType: themeType ?? this.themeType);
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@ import '../../core/app_export.dart';
|
||||
/// Helper class for managing themes and colors.
|
||||
class ThemeHelper {
|
||||
// The current app theme
|
||||
var _appTheme = PrefUtils().getThemeData();
|
||||
var _appTheme = 'primary';
|
||||
|
||||
// A map of custom color themes supported by the app
|
||||
Map<String, PrimaryColors> _supportedCustomColor = {
|
||||
|
||||
Reference in New Issue
Block a user