From 45214b11a08f524a106c589f22bd9bb85d958ee7 Mon Sep 17 00:00:00 2001 From: Bad0RANG3 <110911829+Bad0RANG3@users.noreply.github.com> Date: Mon, 28 Sep 2026 14:50:51 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E6=8A=BD=E5=8F=96=E9=AB=98?= =?UTF-8?q?=E5=8D=B1=E5=8A=9F=E8=83=BD=E9=A1=B5=E5=85=B1=E4=BA=AB=E8=84=9A?= =?UTF-8?q?=E6=89=8B=E6=9E=B6=E4=B8=8E=E4=BC=A0=E8=BE=93=E5=B1=82=E6=97=A5?= =?UTF-8?q?=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 诊断:功能票 / 解锁歌曲 / 收藏品 / 旅行伙伴 / 数值修改 / 一键跑图 / 万花筒 / 高危 hub 这些页面各自抄了一份同样的脚手架——冷却计时器、_Step 枚举、自动退登开关、卡片/提示/进度卡;TitleApiService.getUserPreview 还 重复实现了整套传输层;服务层有 37 处裸 print 会把 token / JSESSIONID 打进日志。 - 新增共享原语,7 个功能页切换到: * widgets/cooldown_mixin.dart CooldownMixin(登录后冷却倒计时) * widgets/step_progress.dart RiskStep + StepProgressCard * widgets/app_card.dart AppCard / SectionTitle / AutoLogoutToggle * widgets/app_notice.dart AppNotice + context.showSnack - TitleApiService: getUserPreview 收敛进通用 _callApi;新增 fromHolder() 工厂与 config getter,消除散落的 isConfigured + config! - 传输层 print -> ApiLog(仅 debug 输出),删除全部 avoid_print 忽略 - UserAllPayloadBuilder 新增 placeholderMusicData()(原 5 处重复) - LoginPage 从 main.dart 抽到 pages/login_page.dart,入口只留 main + MyApp - 更新 README / CLAUDE.md 目录结构与已过时的 web/依赖说明 验证:flutter analyze 0 issue(含 info);flutter test 96/96 通过。 纯结构重构,行为保持不变;仅有意统一了功能票 / 音乐风险 / hub 的 卡片与步骤视觉样式。 净删除约 2176 行重复代码。 --- CLAUDE.md | 63 ++-- README.md | 24 +- lib/main.dart | 297 +--------------- lib/pages/best50_page.dart | 5 +- lib/pages/high_risk_feature_page.dart | 124 +------ lib/pages/home_page.dart | 16 +- lib/pages/kaleidx_scope_page.dart | 300 +++-------------- lib/pages/login_page.dart | 299 ++++++++++++++++ lib/pages/map_traverse_page.dart | 297 +++------------- lib/pages/music_risk_feature_view.dart | 375 ++++----------------- lib/pages/number_patch_page.dart | 299 +++------------- lib/pages/ticket_page.dart | 344 +++---------------- lib/pages/travel_partner_page.dart | 301 +++-------------- lib/services/api_log.dart | 18 + lib/services/api_service.dart | 7 +- lib/services/title_api_service.dart | 173 +++------- lib/services/user_all_payload_builder.dart | 17 + lib/widgets/app_card.dart | 126 +++++++ lib/widgets/app_notice.dart | 62 ++++ lib/widgets/cooldown_mixin.dart | 92 +++++ lib/widgets/step_progress.dart | 133 ++++++++ 21 files changed, 1196 insertions(+), 2176 deletions(-) create mode 100644 lib/pages/login_page.dart create mode 100644 lib/services/api_log.dart create mode 100644 lib/widgets/app_card.dart create mode 100644 lib/widgets/app_notice.dart create mode 100644 lib/widgets/cooldown_mixin.dart create mode 100644 lib/widgets/step_progress.dart diff --git a/CLAUDE.md b/CLAUDE.md index dcb77b1..6e323dc 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -5,12 +5,9 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co ## Build & Development Commands ```bash -# Run the app (launches on connected device or browser) +# Run the app (launches on connected device) flutter run -# Run specifically for web (primary target) -flutter run -d chrome - # Run analyzer flutter analyze @@ -20,8 +17,12 @@ flutter test # Run a single test file flutter test test/widget_test.dart -# Build for web -flutter build web +# Build release artifacts +flutter build apk --release # Android +flutter build windows --release # Windows +flutter build macos --release # macOS +flutter build linux --release # Linux +flutter build ios --release --no-codesign # iOS(无证书时只验证可编译) # Check for outdated dependencies flutter pub outdated @@ -32,31 +33,55 @@ flutter pub upgrade --major-versions ## Architecture -This is a Flutter app (targeting mobile native) that serves as a QR-code-based login client for the maimai DX arcade game network. +This is a Flutter app (Android / iOS / Windows / macOS / Linux) that serves as a QR-code-based +login client for the maimai DX arcade game network. ### Code Layout ``` lib/ -├── main.dart # App entry point, LoginPage widget (the entire UI) +├── main.dart # 入口:main() + MyApp(MaterialApp) +├── pages/ +│ ├── login_page.dart # 登录页(QR 粘贴 / 图片识别) +│ ├── home_page.dart # 主页骨架(底部导航 + 各 tab) +│ ├── settings_page.dart # Title Server / 机器参数配置 +│ └── ... # 各功能页(ticket / best50 / 风险操作等) +├── widgets/ +│ ├── cooldown_mixin.dart # CooldownMixin:登录后冷却倒计时 +│ ├── step_progress.dart # RiskStep + StepProgressCard +│ ├── app_card.dart # AppCard / SectionTitle / AutoLogoutToggle +│ ├── app_notice.dart # AppNotice + context.showSnack +│ └── best50_poster.dart # B50 成绩图 └── services/ - ├── api_service.dart # API client for game server auth - ├── qr_service.dart # Platform-agnostic QR decode interface (conditional import) - ├── qr_service_native.dart # Native stub — QR decode is NOT implemented on mobile/desktop - └── qr_service_web.dart # Web QR decode via jsQR (loaded in web/index.html via CDN) + ├── api_service.dart # Aime 登录 API 客户端 + ├── title_api_service.dart # 游戏服务器传输层(加解密 / 会话 / 各 Api) + ├── user_all_payload_builder.dart # UpsertUserAll 组装与各补丁 + ├── api_log.dart # 传输层调试日志(仅 debug) + └── ... ``` ### Key Design Decisions -- **Single-widget app**: The entire app is currently one `LoginPage` widget in `main.dart`. There is no routing — the login result shows an `AlertDialog`. -- **Conditional imports for platform code**: `qr_service.dart` uses the `if (dart.library.html)` syntax to import `qr_service_web.dart` on web and `qr_service_native.dart` everywhere else. Native QR scanning returns `null` (not implemented). -- **Web is the primary target**: jsQR is loaded via CDN `