chore: 汇总批量提交的功能优化与bug修复

本次提交包含多项迭代优化和问题修复:
1. 新增缩略图图片组件、数字格式化工具类,补充多语言翻译类型与本地化支持
2. 优化底部导航栏主题色统一使用动态accent色值
3. 修复多处图表动画、路由跳转、API请求相关问题
4. 简化服务器公告文案,调整默认分屏状态为关闭
5. 新增安卓/iOS桌面快捷方式配置
6. 重构多处状态管理类使用SafeNotifierInit统一异常保护
7. 替换硬编码蓝色为主题色,更新版本号获取方式为动态读取
8. 优化缓存预加载逻辑,移除无用代码
9. 调整默认设置项,优化用户体验细节
This commit is contained in:
Developer
2026-05-31 12:24:05 +08:00
parent 0da8906f5d
commit 9ea8d3d606
298 changed files with 48547 additions and 21836 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -33,6 +33,7 @@ class HiveBoxNames {
static const String leisure = 'leisure';
static const String imageCacheMeta = 'image_cache_meta';
static const String featureFlags = 'feature_flags';
static const String cacheCleanLog = 'cache_clean_log';
static const List<String> all = [
app,
@@ -47,6 +48,7 @@ class HiveBoxNames {
leisure,
imageCacheMeta,
featureFlags,
cacheCleanLog,
];
}
@@ -405,6 +407,68 @@ class KvStorage {
return b.clear();
}
// ============================================================
// 工具搜索历史按工具ID隔离
// ============================================================
static List<String> getToolSearchHistory(String toolId) {
final raw = _box(HiveBoxNames.searchHistory)?.get('tool_$toolId') as String?;
if (raw == null || raw.isEmpty) return [];
try {
return List<String>.from(jsonDecode(raw) as List);
} catch (_) {
return [];
}
}
static Future<void> setToolSearchHistory(
String toolId,
List<String> history,
) {
final b = _box(HiveBoxNames.searchHistory);
if (b == null) return Future.value();
return b.put('tool_$toolId', jsonEncode(history));
}
static Future<void> addToolSearchHistory(
String toolId,
String keyword, {
int maxCount = 20,
}) {
final list = getToolSearchHistory(toolId);
list
..removeWhere((h) => h == keyword)
..insert(0, keyword);
if (list.length > maxCount) list.removeRange(maxCount, list.length);
return setToolSearchHistory(toolId, list);
}
static Future<void> clearToolSearchHistory(String toolId) {
final b = _box(HiveBoxNames.searchHistory);
if (b == null) return Future.value();
return b.delete('tool_$toolId');
}
// ============================================================
// 工具排序偏好
// ============================================================
static List<String> getToolSortOrder() {
final raw = _box(HiveBoxNames.userPrefs)?.get('tool_sort_order') as String?;
if (raw == null || raw.isEmpty) return [];
try {
return List<String>.from(jsonDecode(raw) as List);
} catch (_) {
return [];
}
}
static Future<void> setToolSortOrder(List<String> order) {
final b = _box(HiveBoxNames.userPrefs);
if (b == null) return Future.value();
return b.put('tool_sort_order', jsonEncode(order));
}
// ============================================================
// 用户偏好
// ============================================================