feat: 全面迁移到 Flutter + 新增 GitHub 源与 CI 流水线
前端
- 移除全部 Avalonia 依赖,模型渲染与界面统一改用 Flutter
- 新增用户页:登录/注册(SHA-512 + 盐)、签到积分(30 天一循环)、
主题色积分购买、二选一随机、今日人品
- 新增百宝箱页、模型内嵌渲染页、自绘标题栏(最小化/最大化/关闭)
- 下载页显示模型下载进度条,下载源读取加速
- 关于页新增「重新下载启动器」并在下载后做 sha256 完整性校验
- 修复浅色主题下标题栏不跟随主题色、无法连接后端等问题
后端
- 新增 UserService:.GC/user/<用户名>.yaml 存用户名/积分/SHA-512 口令,
登录返回 session token,本地 .GC/user/user.yaml 保存登录态
- 新增 /api/user/{register,login,me,signin,theme} 接口
- 去掉 Avalonia 窗口宿主,后端只提供 HTTP API
下载源
- 新增 GitHub 镜像源(Morris-morris-cloud/GC),与 Xhmcl 并发测速
- 单源探测超时收紧到 2 秒,取最快且可用的源;GitHub 复用 GiteaRemote
(contents 带 ref、releases 带 per_page=100)
构建与 CI
- macOS 上默认只出 macOS 包,Windows 交给原生 Windows 构建
- 修复 Windows 交叉编译中 flutter-cpp-client-wrapper 双层目录嵌套
- 新增 GitHub Actions:
· nightly-prerelease:每天 21:00 编译三平台,发布 nightly 预发布
· build-bot:Issue/PR 评论 @build-bot build <mac|win-amd|win-arm|all>,
发布 ip-prerelease 预发布
· pr-review:检查能否编译、静态分析、合并冲突、是否落后 main
- 忽略 79MB 课件产物等高线.html 与工具链临时备份
This commit is contained in:
1 parent
b9cb56cb8b
commit
ea1fa6b6d1
134 files changed
+4309
-16614
No files matched your search
@@ -0,0 +1,163 @@
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../controller.dart';
|
||||
import '../theme.dart';
|
||||
import '../i18n.dart';
|
||||
|
||||
/// 百宝箱页:今日人品、随机运势等小玩意。
|
||||
class TreasurePage extends StatefulWidget {
|
||||
const TreasurePage({super.key, required this.controller});
|
||||
|
||||
final ShellController controller;
|
||||
|
||||
@override
|
||||
State<TreasurePage> createState() => _TreasurePageState();
|
||||
}
|
||||
|
||||
class _TreasurePageState extends State<TreasurePage> {
|
||||
String _fortune = '';
|
||||
String _luckyColor = '';
|
||||
String _luckyNumber = '';
|
||||
bool _loading = false;
|
||||
final Random _rand = Random();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_refresh();
|
||||
}
|
||||
|
||||
void _refresh() {
|
||||
setState(() => _loading = true);
|
||||
// 模拟计算延迟
|
||||
Future.delayed(const Duration(milliseconds: 400), () {
|
||||
if (!mounted) return;
|
||||
final fortunes = <String>[
|
||||
'今日宜:尝试新事物,突破舒适区。',
|
||||
'运气不错,适合做重要的决定。',
|
||||
'财运旺盛,可能会有意外收获。',
|
||||
'人际和谐,适合合作与沟通。',
|
||||
'专注当下,好运自然来。',
|
||||
'保持乐观,今天会有好消息。',
|
||||
'灵感涌现,适合创作和思考。',
|
||||
'脚踏实地,一步一个脚印。',
|
||||
'贵人运旺,多与他人交流。',
|
||||
'健康第一,注意休息和锻炼。',
|
||||
];
|
||||
final colors = <String>[
|
||||
'红色', '蓝色', '绿色', '金色', '紫色', '橙色', '粉色', '青色',
|
||||
];
|
||||
setState(() {
|
||||
_fortune = fortunes[_rand.nextInt(fortunes.length)];
|
||||
_luckyColor = colors[_rand.nextInt(colors.length)];
|
||||
_luckyNumber = '${(_rand.nextInt(99)) + 1}';
|
||||
_loading = false;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: GcColors.appBg,
|
||||
body: _loading
|
||||
? const Center(child: CircularProgressIndicator())
|
||||
: Center(
|
||||
child: ConstrainedBox(
|
||||
constraints: const BoxConstraints(maxWidth: 480),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
// 今日人品卡片
|
||||
GcCard(
|
||||
padding: const EdgeInsets.all(GcSpace.xxl),
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Icon(
|
||||
Icons.star_rounded,
|
||||
size: 48,
|
||||
color: GcColors.accent,
|
||||
),
|
||||
const SizedBox(height: GcSpace.lg),
|
||||
Text(
|
||||
T('treasure.fortuneTitle'),
|
||||
style: const TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: GcSpace.md),
|
||||
Text(
|
||||
_fortune,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
height: 1.5,
|
||||
color: GcColors.muted,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: GcSpace.lg),
|
||||
// 幸运信息
|
||||
Wrap(
|
||||
spacing: GcSpace.md,
|
||||
runSpacing: GcSpace.md,
|
||||
children: <Widget>[
|
||||
_buildStatCard(
|
||||
icon: Icons.check_circle_outline_rounded,
|
||||
label: T('treasure.luckyColor'),
|
||||
value: _luckyColor,
|
||||
),
|
||||
_buildStatCard(
|
||||
icon: Icons.numbers_rounded,
|
||||
label: T('treasure.luckyNumber'),
|
||||
value: _luckyNumber,
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: GcSpace.xl),
|
||||
// 刷新按钮
|
||||
FilledButton.icon(
|
||||
onPressed: _refresh,
|
||||
icon: const Icon(Icons.refresh_rounded, size: 18),
|
||||
label: Text(T('treasure.refresh')),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildStatCard({
|
||||
required IconData icon,
|
||||
required String label,
|
||||
required String value,
|
||||
}) {
|
||||
return GcCard(
|
||||
padding: const EdgeInsets.all(GcSpace.lg),
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Icon(icon, size: 28, color: GcColors.accent),
|
||||
const SizedBox(height: GcSpace.sm),
|
||||
Text(
|
||||
label,
|
||||
style: TextStyle(fontSize: 12, color: GcColors.muted),
|
||||
),
|
||||
const SizedBox(height: GcSpace.xs),
|
||||
Text(
|
||||
value,
|
||||
style: const TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user