refactor(token): add token storage, remove hive

This commit is contained in:
mso7nueh
2024-08-26 15:04:07 +03:00
parent 603728549d
commit cea81abd21
29 changed files with 98 additions and 271 deletions

View File

@@ -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));
}
}

View File

@@ -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 => [];
}

View File

@@ -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);
}
}

View File

@@ -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 = {