migrate primary color

This commit is contained in:
shenlong-tanwen
2026-05-03 21:16:46 +07:00
parent 6fdb841732
commit 68a718fab4
12 changed files with 41 additions and 46 deletions
@@ -1,18 +1,22 @@
import 'package:flutter/material.dart';
import 'package:immich_mobile/constants/colors.dart';
class ThemeConfig {
final ThemeMode mode;
final ImmichColorPreset primaryColor;
const ThemeConfig({this.mode = .system});
const ThemeConfig({this.mode = .system, this.primaryColor = .indigo});
ThemeConfig copyWith({ThemeMode? mode}) => .new(mode: mode ?? this.mode);
ThemeConfig copyWith({ThemeMode? mode, ImmichColorPreset? primaryColor}) =>
.new(mode: mode ?? this.mode, primaryColor: primaryColor ?? this.primaryColor);
@override
bool operator ==(Object other) => identical(this, other) || (other is ThemeConfig && other.mode == mode);
bool operator ==(Object other) =>
identical(this, other) || (other is ThemeConfig && other.mode == mode && other.primaryColor == primaryColor);
@override
int get hashCode => mode.hashCode;
int get hashCode => Object.hash(mode, primaryColor);
@override
String toString() => 'ThemeConfig(mode: $mode)';
String toString() => 'ThemeConfig(mode: $mode, primaryColor: $primaryColor)';
}
@@ -1,5 +1,6 @@
import 'package:collection/collection.dart';
import 'package:flutter/material.dart';
import 'package:immich_mobile/constants/colors.dart';
import 'package:immich_mobile/domain/models/config/app_config.dart';
import 'package:immich_mobile/domain/models/config/system_config.dart';
import 'package:immich_mobile/domain/models/log.model.dart';
@@ -13,7 +14,11 @@ enum MetadataDomain<T extends Object> {
}
enum MetadataKey<T extends Object> {
// Theme
primaryColor<ImmichColorPreset>(.appConfig, 'theme.primaryColor', .indigo, _EnumCodec(ImmichColorPreset.values)),
themeMode<ThemeMode>(.appConfig, 'theme.mode', .system, _EnumCodec(ThemeMode.values)),
// Log
logLevel<LogLevel>(.systemConfig, 'log.level', .info, _EnumCodec(LogLevel.values));
final MetadataDomain domain;
+1 -1
View File
@@ -49,7 +49,6 @@ enum StoreKey<T> {
customHeaders<String>._(127),
// theme settings
primaryColor<String>._(128),
dynamicTheme<bool>._(129),
colorfulInterface<bool>._(130),
@@ -95,6 +94,7 @@ enum StoreKey<T> {
syncMigrationStatus<String>._(1013),
// Legacy keys that have been migrated to the new metadata store
legacyPrimaryColor<String>._(128),
legacyThemeMode<String>._(102),
legacyLogLevel<int>._(115);