home layout

This commit is contained in:
Christien Rioux 2023-07-28 20:36:05 -04:00
parent f754f7d5ed
commit ca6b00e021
45 changed files with 2168 additions and 561 deletions

View file

@ -48,6 +48,8 @@ class LocalAccount with _$LocalAccount {
// Keep account hidden unless account password is entered
// (tries all hidden accounts with auth method (no biometrics))
required bool hiddenAccount,
// Display name for account until it is unlocked
required String name,
}) = _LocalAccount;
factory LocalAccount.fromJson(dynamic json) =>

View file

@ -34,7 +34,9 @@ mixin _$LocalAccount {
bool get biometricsEnabled =>
throw _privateConstructorUsedError; // Keep account hidden unless account password is entered
// (tries all hidden accounts with auth method (no biometrics))
bool get hiddenAccount => throw _privateConstructorUsedError;
bool get hiddenAccount =>
throw _privateConstructorUsedError; // Display name for account until it is unlocked
String get name => throw _privateConstructorUsedError;
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
@ -54,7 +56,8 @@ abstract class $LocalAccountCopyWith<$Res> {
@Uint8ListJsonConverter() Uint8List identitySecretSaltBytes,
EncryptionKeyType encryptionKeyType,
bool biometricsEnabled,
bool hiddenAccount});
bool hiddenAccount,
String name});
$IdentityMasterCopyWith<$Res> get identityMaster;
}
@ -78,6 +81,7 @@ class _$LocalAccountCopyWithImpl<$Res, $Val extends LocalAccount>
Object? encryptionKeyType = null,
Object? biometricsEnabled = null,
Object? hiddenAccount = null,
Object? name = null,
}) {
return _then(_value.copyWith(
identityMaster: null == identityMaster
@ -104,6 +108,10 @@ class _$LocalAccountCopyWithImpl<$Res, $Val extends LocalAccount>
? _value.hiddenAccount
: hiddenAccount // ignore: cast_nullable_to_non_nullable
as bool,
name: null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String,
) as $Val);
}
@ -130,7 +138,8 @@ abstract class _$$_LocalAccountCopyWith<$Res>
@Uint8ListJsonConverter() Uint8List identitySecretSaltBytes,
EncryptionKeyType encryptionKeyType,
bool biometricsEnabled,
bool hiddenAccount});
bool hiddenAccount,
String name});
@override
$IdentityMasterCopyWith<$Res> get identityMaster;
@ -153,6 +162,7 @@ class __$$_LocalAccountCopyWithImpl<$Res>
Object? encryptionKeyType = null,
Object? biometricsEnabled = null,
Object? hiddenAccount = null,
Object? name = null,
}) {
return _then(_$_LocalAccount(
identityMaster: null == identityMaster
@ -179,6 +189,10 @@ class __$$_LocalAccountCopyWithImpl<$Res>
? _value.hiddenAccount
: hiddenAccount // ignore: cast_nullable_to_non_nullable
as bool,
name: null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
@ -192,7 +206,8 @@ class _$_LocalAccount implements _LocalAccount {
@Uint8ListJsonConverter() required this.identitySecretSaltBytes,
required this.encryptionKeyType,
required this.biometricsEnabled,
required this.hiddenAccount});
required this.hiddenAccount,
required this.name});
factory _$_LocalAccount.fromJson(Map<String, dynamic> json) =>
_$$_LocalAccountFromJson(json);
@ -218,10 +233,13 @@ class _$_LocalAccount implements _LocalAccount {
// (tries all hidden accounts with auth method (no biometrics))
@override
final bool hiddenAccount;
// Display name for account until it is unlocked
@override
final String name;
@override
String toString() {
return 'LocalAccount(identityMaster: $identityMaster, identitySecretKeyBytes: $identitySecretKeyBytes, identitySecretSaltBytes: $identitySecretSaltBytes, encryptionKeyType: $encryptionKeyType, biometricsEnabled: $biometricsEnabled, hiddenAccount: $hiddenAccount)';
return 'LocalAccount(identityMaster: $identityMaster, identitySecretKeyBytes: $identitySecretKeyBytes, identitySecretSaltBytes: $identitySecretSaltBytes, encryptionKeyType: $encryptionKeyType, biometricsEnabled: $biometricsEnabled, hiddenAccount: $hiddenAccount, name: $name)';
}
@override
@ -240,7 +258,8 @@ class _$_LocalAccount implements _LocalAccount {
(identical(other.biometricsEnabled, biometricsEnabled) ||
other.biometricsEnabled == biometricsEnabled) &&
(identical(other.hiddenAccount, hiddenAccount) ||
other.hiddenAccount == hiddenAccount));
other.hiddenAccount == hiddenAccount) &&
(identical(other.name, name) || other.name == name));
}
@JsonKey(ignore: true)
@ -252,7 +271,8 @@ class _$_LocalAccount implements _LocalAccount {
const DeepCollectionEquality().hash(identitySecretSaltBytes),
encryptionKeyType,
biometricsEnabled,
hiddenAccount);
hiddenAccount,
name);
@JsonKey(ignore: true)
@override
@ -276,7 +296,8 @@ abstract class _LocalAccount implements LocalAccount {
required final Uint8List identitySecretSaltBytes,
required final EncryptionKeyType encryptionKeyType,
required final bool biometricsEnabled,
required final bool hiddenAccount}) = _$_LocalAccount;
required final bool hiddenAccount,
required final String name}) = _$_LocalAccount;
factory _LocalAccount.fromJson(Map<String, dynamic> json) =
_$_LocalAccount.fromJson;
@ -296,6 +317,8 @@ abstract class _LocalAccount implements LocalAccount {
@override // Keep account hidden unless account password is entered
// (tries all hidden accounts with auth method (no biometrics))
bool get hiddenAccount;
@override // Display name for account until it is unlocked
String get name;
@override
@JsonKey(ignore: true)
_$$_LocalAccountCopyWith<_$_LocalAccount> get copyWith =>

View file

@ -17,6 +17,7 @@ _$_LocalAccount _$$_LocalAccountFromJson(Map<String, dynamic> json) =>
EncryptionKeyType.fromJson(json['encryption_key_type']),
biometricsEnabled: json['biometrics_enabled'] as bool,
hiddenAccount: json['hidden_account'] as bool,
name: json['name'] as String,
);
Map<String, dynamic> _$$_LocalAccountToJson(_$_LocalAccount instance) =>
@ -29,4 +30,5 @@ Map<String, dynamic> _$$_LocalAccountToJson(_$_LocalAccount instance) =>
'encryption_key_type': instance.encryptionKeyType.toJson(),
'biometrics_enabled': instance.biometricsEnabled,
'hidden_account': instance.hiddenAccount,
'name': instance.name,
};

View file

@ -6,13 +6,13 @@ part 'preferences.g.dart';
// Theme supports light and dark mode, optionally selected by the
// operating system
enum DarkModePreference {
enum BrightnessPreference {
system,
light,
dark;
factory DarkModePreference.fromJson(dynamic j) =>
DarkModePreference.values.byName((j as String).toCamelCase());
factory BrightnessPreference.fromJson(dynamic j) =>
BrightnessPreference.values.byName((j as String).toCamelCase());
String toJson() => name.toPascalCase();
}
@ -33,34 +33,20 @@ class LockPreference with _$LockPreference {
// Theme supports multiple color variants based on 'Radix'
enum ColorPreference {
amber,
blue,
bronze,
brown,
crimson,
cyan,
// Radix Colors
scarlet,
babydoll,
vapor,
gold,
grass,
gray,
green,
indigo,
garden,
forest,
arctic,
lapis,
eggplant,
lime,
mauve,
mint,
olive,
orange,
pink,
plum,
purple,
red,
sage,
sand,
sky,
slate,
teal,
tomato,
violet,
yellow;
grim,
// Accessible Colors
contrast;
factory ColorPreference.fromJson(dynamic j) =>
ColorPreference.values.byName((j as String).toCamelCase());
@ -76,15 +62,25 @@ enum LanguagePreference {
String toJson() => name.toPascalCase();
}
@freezed
class ThemePreferences with _$ThemePreferences {
const factory ThemePreferences({
required BrightnessPreference brightnessPreference,
required ColorPreference colorPreference,
required double displayScale,
}) = _ThemePreferences;
factory ThemePreferences.fromJson(dynamic json) =>
_$ThemePreferencesFromJson(json as Map<String, dynamic>);
}
// Preferences are stored in a table locally and globally affect all
// accounts imported/added and the app in general
@freezed
class Preferences with _$Preferences {
const factory Preferences({
required DarkModePreference darkMode,
required ColorPreference themeColor,
required ThemePreferences themePreferences,
required LanguagePreference language,
required int displayScale,
required LockPreference locking,
}) = _Preferences;

View file

@ -198,16 +198,199 @@ abstract class _LockPreference implements LockPreference {
throw _privateConstructorUsedError;
}
ThemePreferences _$ThemePreferencesFromJson(Map<String, dynamic> json) {
return _ThemePreferences.fromJson(json);
}
/// @nodoc
mixin _$ThemePreferences {
BrightnessPreference get brightnessPreference =>
throw _privateConstructorUsedError;
ColorPreference get colorPreference => throw _privateConstructorUsedError;
double get displayScale => throw _privateConstructorUsedError;
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
$ThemePreferencesCopyWith<ThemePreferences> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $ThemePreferencesCopyWith<$Res> {
factory $ThemePreferencesCopyWith(
ThemePreferences value, $Res Function(ThemePreferences) then) =
_$ThemePreferencesCopyWithImpl<$Res, ThemePreferences>;
@useResult
$Res call(
{BrightnessPreference brightnessPreference,
ColorPreference colorPreference,
double displayScale});
}
/// @nodoc
class _$ThemePreferencesCopyWithImpl<$Res, $Val extends ThemePreferences>
implements $ThemePreferencesCopyWith<$Res> {
_$ThemePreferencesCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
@pragma('vm:prefer-inline')
@override
$Res call({
Object? brightnessPreference = null,
Object? colorPreference = null,
Object? displayScale = null,
}) {
return _then(_value.copyWith(
brightnessPreference: null == brightnessPreference
? _value.brightnessPreference
: brightnessPreference // ignore: cast_nullable_to_non_nullable
as BrightnessPreference,
colorPreference: null == colorPreference
? _value.colorPreference
: colorPreference // ignore: cast_nullable_to_non_nullable
as ColorPreference,
displayScale: null == displayScale
? _value.displayScale
: displayScale // ignore: cast_nullable_to_non_nullable
as double,
) as $Val);
}
}
/// @nodoc
abstract class _$$_ThemePreferencesCopyWith<$Res>
implements $ThemePreferencesCopyWith<$Res> {
factory _$$_ThemePreferencesCopyWith(
_$_ThemePreferences value, $Res Function(_$_ThemePreferences) then) =
__$$_ThemePreferencesCopyWithImpl<$Res>;
@override
@useResult
$Res call(
{BrightnessPreference brightnessPreference,
ColorPreference colorPreference,
double displayScale});
}
/// @nodoc
class __$$_ThemePreferencesCopyWithImpl<$Res>
extends _$ThemePreferencesCopyWithImpl<$Res, _$_ThemePreferences>
implements _$$_ThemePreferencesCopyWith<$Res> {
__$$_ThemePreferencesCopyWithImpl(
_$_ThemePreferences _value, $Res Function(_$_ThemePreferences) _then)
: super(_value, _then);
@pragma('vm:prefer-inline')
@override
$Res call({
Object? brightnessPreference = null,
Object? colorPreference = null,
Object? displayScale = null,
}) {
return _then(_$_ThemePreferences(
brightnessPreference: null == brightnessPreference
? _value.brightnessPreference
: brightnessPreference // ignore: cast_nullable_to_non_nullable
as BrightnessPreference,
colorPreference: null == colorPreference
? _value.colorPreference
: colorPreference // ignore: cast_nullable_to_non_nullable
as ColorPreference,
displayScale: null == displayScale
? _value.displayScale
: displayScale // ignore: cast_nullable_to_non_nullable
as double,
));
}
}
/// @nodoc
@JsonSerializable()
class _$_ThemePreferences implements _ThemePreferences {
const _$_ThemePreferences(
{required this.brightnessPreference,
required this.colorPreference,
required this.displayScale});
factory _$_ThemePreferences.fromJson(Map<String, dynamic> json) =>
_$$_ThemePreferencesFromJson(json);
@override
final BrightnessPreference brightnessPreference;
@override
final ColorPreference colorPreference;
@override
final double displayScale;
@override
String toString() {
return 'ThemePreferences(brightnessPreference: $brightnessPreference, colorPreference: $colorPreference, displayScale: $displayScale)';
}
@override
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$_ThemePreferences &&
(identical(other.brightnessPreference, brightnessPreference) ||
other.brightnessPreference == brightnessPreference) &&
(identical(other.colorPreference, colorPreference) ||
other.colorPreference == colorPreference) &&
(identical(other.displayScale, displayScale) ||
other.displayScale == displayScale));
}
@JsonKey(ignore: true)
@override
int get hashCode => Object.hash(
runtimeType, brightnessPreference, colorPreference, displayScale);
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$_ThemePreferencesCopyWith<_$_ThemePreferences> get copyWith =>
__$$_ThemePreferencesCopyWithImpl<_$_ThemePreferences>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$_ThemePreferencesToJson(
this,
);
}
}
abstract class _ThemePreferences implements ThemePreferences {
const factory _ThemePreferences(
{required final BrightnessPreference brightnessPreference,
required final ColorPreference colorPreference,
required final double displayScale}) = _$_ThemePreferences;
factory _ThemePreferences.fromJson(Map<String, dynamic> json) =
_$_ThemePreferences.fromJson;
@override
BrightnessPreference get brightnessPreference;
@override
ColorPreference get colorPreference;
@override
double get displayScale;
@override
@JsonKey(ignore: true)
_$$_ThemePreferencesCopyWith<_$_ThemePreferences> get copyWith =>
throw _privateConstructorUsedError;
}
Preferences _$PreferencesFromJson(Map<String, dynamic> json) {
return _Preferences.fromJson(json);
}
/// @nodoc
mixin _$Preferences {
DarkModePreference get darkMode => throw _privateConstructorUsedError;
ColorPreference get themeColor => throw _privateConstructorUsedError;
ThemePreferences get themePreferences => throw _privateConstructorUsedError;
LanguagePreference get language => throw _privateConstructorUsedError;
int get displayScale => throw _privateConstructorUsedError;
LockPreference get locking => throw _privateConstructorUsedError;
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@ -223,12 +406,11 @@ abstract class $PreferencesCopyWith<$Res> {
_$PreferencesCopyWithImpl<$Res, Preferences>;
@useResult
$Res call(
{DarkModePreference darkMode,
ColorPreference themeColor,
{ThemePreferences themePreferences,
LanguagePreference language,
int displayScale,
LockPreference locking});
$ThemePreferencesCopyWith<$Res> get themePreferences;
$LockPreferenceCopyWith<$Res> get locking;
}
@ -245,29 +427,19 @@ class _$PreferencesCopyWithImpl<$Res, $Val extends Preferences>
@pragma('vm:prefer-inline')
@override
$Res call({
Object? darkMode = null,
Object? themeColor = null,
Object? themePreferences = null,
Object? language = null,
Object? displayScale = null,
Object? locking = null,
}) {
return _then(_value.copyWith(
darkMode: null == darkMode
? _value.darkMode
: darkMode // ignore: cast_nullable_to_non_nullable
as DarkModePreference,
themeColor: null == themeColor
? _value.themeColor
: themeColor // ignore: cast_nullable_to_non_nullable
as ColorPreference,
themePreferences: null == themePreferences
? _value.themePreferences
: themePreferences // ignore: cast_nullable_to_non_nullable
as ThemePreferences,
language: null == language
? _value.language
: language // ignore: cast_nullable_to_non_nullable
as LanguagePreference,
displayScale: null == displayScale
? _value.displayScale
: displayScale // ignore: cast_nullable_to_non_nullable
as int,
locking: null == locking
? _value.locking
: locking // ignore: cast_nullable_to_non_nullable
@ -275,6 +447,14 @@ class _$PreferencesCopyWithImpl<$Res, $Val extends Preferences>
) as $Val);
}
@override
@pragma('vm:prefer-inline')
$ThemePreferencesCopyWith<$Res> get themePreferences {
return $ThemePreferencesCopyWith<$Res>(_value.themePreferences, (value) {
return _then(_value.copyWith(themePreferences: value) as $Val);
});
}
@override
@pragma('vm:prefer-inline')
$LockPreferenceCopyWith<$Res> get locking {
@ -293,12 +473,12 @@ abstract class _$$_PreferencesCopyWith<$Res>
@override
@useResult
$Res call(
{DarkModePreference darkMode,
ColorPreference themeColor,
{ThemePreferences themePreferences,
LanguagePreference language,
int displayScale,
LockPreference locking});
@override
$ThemePreferencesCopyWith<$Res> get themePreferences;
@override
$LockPreferenceCopyWith<$Res> get locking;
}
@ -314,29 +494,19 @@ class __$$_PreferencesCopyWithImpl<$Res>
@pragma('vm:prefer-inline')
@override
$Res call({
Object? darkMode = null,
Object? themeColor = null,
Object? themePreferences = null,
Object? language = null,
Object? displayScale = null,
Object? locking = null,
}) {
return _then(_$_Preferences(
darkMode: null == darkMode
? _value.darkMode
: darkMode // ignore: cast_nullable_to_non_nullable
as DarkModePreference,
themeColor: null == themeColor
? _value.themeColor
: themeColor // ignore: cast_nullable_to_non_nullable
as ColorPreference,
themePreferences: null == themePreferences
? _value.themePreferences
: themePreferences // ignore: cast_nullable_to_non_nullable
as ThemePreferences,
language: null == language
? _value.language
: language // ignore: cast_nullable_to_non_nullable
as LanguagePreference,
displayScale: null == displayScale
? _value.displayScale
: displayScale // ignore: cast_nullable_to_non_nullable
as int,
locking: null == locking
? _value.locking
: locking // ignore: cast_nullable_to_non_nullable
@ -349,29 +519,23 @@ class __$$_PreferencesCopyWithImpl<$Res>
@JsonSerializable()
class _$_Preferences implements _Preferences {
const _$_Preferences(
{required this.darkMode,
required this.themeColor,
{required this.themePreferences,
required this.language,
required this.displayScale,
required this.locking});
factory _$_Preferences.fromJson(Map<String, dynamic> json) =>
_$$_PreferencesFromJson(json);
@override
final DarkModePreference darkMode;
@override
final ColorPreference themeColor;
final ThemePreferences themePreferences;
@override
final LanguagePreference language;
@override
final int displayScale;
@override
final LockPreference locking;
@override
String toString() {
return 'Preferences(darkMode: $darkMode, themeColor: $themeColor, language: $language, displayScale: $displayScale, locking: $locking)';
return 'Preferences(themePreferences: $themePreferences, language: $language, locking: $locking)';
}
@override
@ -379,21 +543,17 @@ class _$_Preferences implements _Preferences {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$_Preferences &&
(identical(other.darkMode, darkMode) ||
other.darkMode == darkMode) &&
(identical(other.themeColor, themeColor) ||
other.themeColor == themeColor) &&
(identical(other.themePreferences, themePreferences) ||
other.themePreferences == themePreferences) &&
(identical(other.language, language) ||
other.language == language) &&
(identical(other.displayScale, displayScale) ||
other.displayScale == displayScale) &&
(identical(other.locking, locking) || other.locking == locking));
}
@JsonKey(ignore: true)
@override
int get hashCode => Object.hash(
runtimeType, darkMode, themeColor, language, displayScale, locking);
int get hashCode =>
Object.hash(runtimeType, themePreferences, language, locking);
@JsonKey(ignore: true)
@override
@ -411,24 +571,18 @@ class _$_Preferences implements _Preferences {
abstract class _Preferences implements Preferences {
const factory _Preferences(
{required final DarkModePreference darkMode,
required final ColorPreference themeColor,
{required final ThemePreferences themePreferences,
required final LanguagePreference language,
required final int displayScale,
required final LockPreference locking}) = _$_Preferences;
factory _Preferences.fromJson(Map<String, dynamic> json) =
_$_Preferences.fromJson;
@override
DarkModePreference get darkMode;
@override
ColorPreference get themeColor;
ThemePreferences get themePreferences;
@override
LanguagePreference get language;
@override
int get displayScale;
@override
LockPreference get locking;
@override
@JsonKey(ignore: true)

View file

@ -20,20 +20,31 @@ Map<String, dynamic> _$$_LockPreferenceToJson(_$_LockPreference instance) =>
'lock_with_system_lock': instance.lockWithSystemLock,
};
_$_ThemePreferences _$$_ThemePreferencesFromJson(Map<String, dynamic> json) =>
_$_ThemePreferences(
brightnessPreference:
BrightnessPreference.fromJson(json['brightness_preference']),
colorPreference: ColorPreference.fromJson(json['color_preference']),
displayScale: (json['display_scale'] as num).toDouble(),
);
Map<String, dynamic> _$$_ThemePreferencesToJson(_$_ThemePreferences instance) =>
<String, dynamic>{
'brightness_preference': instance.brightnessPreference.toJson(),
'color_preference': instance.colorPreference.toJson(),
'display_scale': instance.displayScale,
};
_$_Preferences _$$_PreferencesFromJson(Map<String, dynamic> json) =>
_$_Preferences(
darkMode: DarkModePreference.fromJson(json['dark_mode']),
themeColor: ColorPreference.fromJson(json['theme_color']),
themePreferences: ThemePreferences.fromJson(json['theme_preferences']),
language: LanguagePreference.fromJson(json['language']),
displayScale: json['display_scale'] as int,
locking: LockPreference.fromJson(json['locking']),
);
Map<String, dynamic> _$$_PreferencesToJson(_$_Preferences instance) =>
<String, dynamic>{
'dark_mode': instance.darkMode.toJson(),
'theme_color': instance.themeColor.toJson(),
'theme_preferences': instance.themePreferences.toJson(),
'language': instance.language.toJson(),
'display_scale': instance.displayScale,
'locking': instance.locking.toJson(),
};