refactor(ui): 删除百宝箱页;设置页去掉主题色
- 删除 pages/treasure.dart 与侧栏「百宝箱」入口,用户页从 index 6 前移到 5 - 清理 pages.dart 导出与 i18n 里的 nav.treasure / treasure.* 键 - 设置页移除主题色色板、自定义颜色入口与 _applyAccent 等实现 - 强调色改由用户账号的 theme_color 决定: · controller._applySettings 不再应用 settings.accentColor · 启动后 _applyUserTheme() 拉一次 /api/user/me 并按 theme_color 上色 · 退出登录回落到 GcPalette.defaultAccent - 清理 i18n 中的 set.accent.* 键与 settings.dart 无用的 dart:async 导入
This commit is contained in:
1 parent
ecb71ad347
commit
38781c9807
7 files changed
+17
-318
No files matched your search
@@ -67,6 +67,8 @@ class ShellController extends ChangeNotifier {
|
||||
if (settingsResult != null) {
|
||||
settings = settingsResult;
|
||||
_applySettings(settingsResult!);
|
||||
// 主题色现在归用户账号所有(设置页不再提供),启动时按当前用户恢复
|
||||
unawaited(_applyUserTheme());
|
||||
}
|
||||
|
||||
if (firstError != null && settingsResult == null) {
|
||||
@@ -97,10 +99,23 @@ class ShellController extends ChangeNotifier {
|
||||
|
||||
void _applySettings(SettingsInfo value) {
|
||||
I18n.setLanguage(value.language);
|
||||
GcPalette.apply(value.accentColor);
|
||||
// 强调色不再来自设置:由用户账号的 theme_color 决定(见 _applyUserTheme)
|
||||
GcPalette.applyTheme(value.theme);
|
||||
}
|
||||
|
||||
/// 按当前登录用户的 theme_color 应用强调色;未登录时保持默认。
|
||||
Future<void> applyUserTheme() => _applyUserTheme();
|
||||
|
||||
Future<void> _applyUserTheme() async {
|
||||
try {
|
||||
final resp = await api.me();
|
||||
final hex = resp?['theme_color'] as String?;
|
||||
if (hex != null && hex.isNotEmpty) GcPalette.apply('#$hex');
|
||||
} catch (_) {
|
||||
// 后端没起来或未登录:保持当前颜色即可
|
||||
}
|
||||
}
|
||||
|
||||
void goTo(int value) {
|
||||
if (index == value) return;
|
||||
index = value;
|
||||
|
||||
Reference in new issue
Block a user