This commit refactors the user management system to utilize UserCubit, improving state management and separation of concerns. - Replaces UserService with UserCubit for managing user state. - Introduces AppSettings and GlobalSettings models and repositories for managing app-level settings and configurations. - Modifies dependency injection to register the new repositories and cubits. - Updates UI components (LoginPage, SettingsPage, HomePage, AddTransactionDialog, CategoryListPage, TagListPage) to interact with UserCubit and SettingsCubit. - Removes direct dependency on UserRepository in favor of UserCubit for accessing user information. - Streamlines the authentication process by using UserCubit to handle user creation and login. - Improves settings management by using dedicated repositories and cubits for app settings.
54 lines
1.5 KiB
Dart
54 lines
1.5 KiB
Dart
// GENERATED CODE - DO NOT MODIFY BY HAND
|
|
|
|
part of 'app_settings.dart';
|
|
|
|
// **************************************************************************
|
|
// TypeAdapterGenerator
|
|
// **************************************************************************
|
|
|
|
class AppSettingsAdapter extends TypeAdapter<AppSettings> {
|
|
@override
|
|
final typeId = 1005;
|
|
|
|
@override
|
|
AppSettings read(BinaryReader reader) {
|
|
final numOfFields = reader.readByte();
|
|
final fields = <int, dynamic>{
|
|
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
|
|
};
|
|
return AppSettings(
|
|
userId: fields[0] as String,
|
|
languageCode: fields[1] == null ? 'ru' : fields[1] as String,
|
|
isDarkMode: fields[2] == null ? false : fields[2] as bool,
|
|
defaultCurrency: fields[3] == null ? 'RUB' : fields[3] as String,
|
|
updatedAt: fields[4] as DateTime?,
|
|
);
|
|
}
|
|
|
|
@override
|
|
void write(BinaryWriter writer, AppSettings obj) {
|
|
writer
|
|
..writeByte(5)
|
|
..writeByte(0)
|
|
..write(obj.userId)
|
|
..writeByte(1)
|
|
..write(obj.languageCode)
|
|
..writeByte(2)
|
|
..write(obj.isDarkMode)
|
|
..writeByte(3)
|
|
..write(obj.defaultCurrency)
|
|
..writeByte(4)
|
|
..write(obj.updatedAt);
|
|
}
|
|
|
|
@override
|
|
int get hashCode => typeId.hashCode;
|
|
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
other is AppSettingsAdapter &&
|
|
runtimeType == other.runtimeType &&
|
|
typeId == other.typeId;
|
|
}
|