feat: 新增工作台模式、系统托盘,修复多平台兼容性问题
1. 新增工作台三栏布局模式,适配宽屏设备 2. 添加跨平台系统托盘支持,新增托盘图标资源 3. 修复工作台模式下导航返回异常问题 4. 统一JSON类型安全解析,替换硬类型转换 5. 增加macOS深度链接支持,统一渠道分发信息 6. 优化部分页面生命周期和状态加载逻辑 7. 移除废弃的nearby_connections依赖
This commit is contained in:
@@ -1,13 +1,14 @@
|
||||
/// ============================================================
|
||||
/// 闲言APP — 纠错状态管理
|
||||
/// 创建时间: 2026-04-28
|
||||
/// 更新时间: 2026-06-17
|
||||
/// 更新时间: 2026-06-19
|
||||
/// 作用: 纠错提交功能状态管理 + 纠错历史本地缓存(drift)
|
||||
/// 上次更新: 接入 drift 本地缓存,支持离线查看纠错历史
|
||||
/// 上次更新: 修复JSON类型安全问题,使用SafeJson.parseInt替代as int? ?? 0
|
||||
/// ============================================================
|
||||
|
||||
import 'package:drift/drift.dart' show Value;
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:xianyan/core/utils/safe_json.dart';
|
||||
|
||||
import '../../../core/network/api_client.dart';
|
||||
import '../../../core/storage/database/app_database.dart';
|
||||
@@ -97,7 +98,7 @@ class CorrectionItem {
|
||||
sourceId: sourceId,
|
||||
switchVal: switchVal,
|
||||
isLocal: isLocal,
|
||||
createtime: map['createtime'] as int? ?? 0,
|
||||
createtime: SafeJson.parseInt(map['createtime']),
|
||||
content: map['content'] as String? ?? '',
|
||||
username: map['username'] as String? ?? '',
|
||||
email: map['mail'] as String? ?? '',
|
||||
@@ -263,7 +264,7 @@ class CorrectionNotifier extends Notifier<CorrectionState> {
|
||||
data: submitData,
|
||||
);
|
||||
final respData = response.data as Map<String, dynamic>;
|
||||
final code = respData['code'] as int? ?? 0;
|
||||
final code = SafeJson.parseInt(respData['code']);
|
||||
if (code == 1) {
|
||||
// 提交成功,写入本地缓存
|
||||
final nowSec = DateTime.now().millisecondsSinceEpoch ~/ 1000;
|
||||
@@ -332,13 +333,13 @@ class CorrectionNotifier extends Notifier<CorrectionState> {
|
||||
queryParameters: {'page': page, 'limit': limit},
|
||||
);
|
||||
final data = response.data as Map<String, dynamic>;
|
||||
final code = data['code'] as int? ?? 0;
|
||||
final code = SafeJson.parseInt(data['code']);
|
||||
if (code == 1) {
|
||||
final result = data['data'] as Map<String, dynamic>? ?? {};
|
||||
final list = (result['list'] as List<dynamic>? ?? [])
|
||||
.map((e) => CorrectionItem.fromServerMap(e as Map<String, dynamic>))
|
||||
.toList();
|
||||
final total = result['total'] as int? ?? 0;
|
||||
final total = SafeJson.parseInt(result['total']);
|
||||
|
||||
// 3. 全量替换本地缓存
|
||||
await _db.replaceCorrectionRecords(
|
||||
|
||||
Reference in New Issue
Block a user