feat: init YearlyReportUI

This commit is contained in:
xkeyC
2025-12-17 12:26:57 +08:00
parent 9a28257f4a
commit 6ec973144e
12 changed files with 1914 additions and 221 deletions

View File

@@ -25,6 +25,7 @@ import 'package:xml/xml.dart';
import 'dialogs/hosts_booster_dialog_ui.dart';
import 'dialogs/rsi_launcher_enhance_dialog_ui.dart';
import 'yearly_report_ui/yearly_report_ui.dart';
part 'tools_ui_model.g.dart';
@@ -80,6 +81,23 @@ class ToolsUIModel extends _$ToolsUIModel {
),
];
// 2025 年度报告入口 - 2026年1月20日前显示
final deadline = DateTime(2026, 1, 20);
if (DateTime.now().isBefore(deadline)) {
items.insert(
0,
ToolsItemData(
"yearly_report",
"2025 年度报告(限时)",
"查看您在2025年的星际公民游玩统计数据来自本地 log ,请确保在常用电脑上查看。",
const Icon(FontAwesomeIcons.star, size: 22),
onTap: () async {
_openYearlyReport(context);
},
),
);
}
if (!context.mounted) return;
items.add(await _addP4kCard(context));
items.addAll([
@@ -747,6 +765,17 @@ class ToolsUIModel extends _$ToolsUIModel {
appGlobalState,
);
}
void _openYearlyReport(BuildContext context) {
if (state.scInstallPaths.isEmpty) {
showToast(context, S.current.tools_action_info_valid_game_directory_needed);
return;
}
Navigator.of(
context,
).push(FluentPageRoute(builder: (context) => YearlyReportUI(gameInstallPaths: state.scInstallPaths)));
}
}
/// 图形渲染器切换对话框