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
@@ -114,25 +114,41 @@ class _DownloadPageViewState extends State<DownloadPageView> {
|
||||
_error = null;
|
||||
});
|
||||
try {
|
||||
final sources = await widget.controller.api.sources();
|
||||
// 三个请求互不依赖,一起发出去:
|
||||
// 源列表(本地,几乎即时)、任务列表、模型索引(要打远端,最慢)
|
||||
// 以前是 sources → models → jobs 串行等三轮,进页面白等多一秒。
|
||||
final sourcesFuture = widget.controller.api.sources();
|
||||
final jobsFuture = widget.controller.api.jobs();
|
||||
final indexFuture = widget.controller.api.remoteModels(
|
||||
sourceId: _selectedSourceId,
|
||||
);
|
||||
|
||||
final sources = await sourcesFuture;
|
||||
final preferred = sources.where((s) => s.enabled).toList();
|
||||
final selected = _selectedSourceId ??
|
||||
(preferred.isNotEmpty
|
||||
? preferred.first.id
|
||||
: (sources.isNotEmpty ? sources.first.id : ''));
|
||||
|
||||
final index = selected.isEmpty
|
||||
? null
|
||||
: await widget.controller.api.remoteModels(sourceId: selected);
|
||||
// 源列表是本地的,先画出来:右侧模型列表还在等远端索引,左侧不必陪着转圈
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_sources = sources;
|
||||
_selectedSourceId = selected;
|
||||
});
|
||||
}
|
||||
|
||||
final index = await indexFuture;
|
||||
final jobs = await jobsFuture;
|
||||
|
||||
if (!mounted) return;
|
||||
setState(() {
|
||||
_sources = sources;
|
||||
_selectedSourceId = selected;
|
||||
_index = index;
|
||||
_jobs = jobs;
|
||||
_loading = false;
|
||||
});
|
||||
await _refreshJobs();
|
||||
} catch (error) {
|
||||
if (!mounted) return;
|
||||
setState(() {
|
||||
@@ -440,16 +456,97 @@ class _DownloadPageViewState extends State<DownloadPageView> {
|
||||
),
|
||||
),
|
||||
const SizedBox(width: GcSpace.lg),
|
||||
if (model.installed)
|
||||
OutlinedButton(
|
||||
onPressed: () => _download(model),
|
||||
child: Text(T('dl.reinstall')),
|
||||
)
|
||||
else
|
||||
FilledButton(
|
||||
onPressed: () => _download(model),
|
||||
child: Text(T('dl.download')),
|
||||
_downloadAction(model),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// 该模型是否有进行中的下载任务。
|
||||
JobInfo? _activeJobFor(String modelId) {
|
||||
for (final job in _jobs) {
|
||||
if (job.isActive && job.modelId == modelId) return job;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// 按钮位:空闲时是「下载 / 重新下载」,下载中就变成这一行的进度条。
|
||||
Widget _downloadAction(RemoteModelInfo model) {
|
||||
final job = _activeJobFor(model.id);
|
||||
if (job == null) {
|
||||
if (model.installed) {
|
||||
return OutlinedButton(
|
||||
onPressed: () => _download(model),
|
||||
child: Text(T('dl.reinstall')),
|
||||
);
|
||||
}
|
||||
return FilledButton(
|
||||
onPressed: () => _download(model),
|
||||
child: Text(T('dl.download')),
|
||||
);
|
||||
}
|
||||
|
||||
final value = job.progress.clamp(0.0, 1.0).toDouble();
|
||||
final percent = (value * 100).round();
|
||||
final detail = job.detailText.isNotEmpty ? job.detailText : job.statusText;
|
||||
|
||||
return SizedBox(
|
||||
width: 148,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: <Widget>[
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Text(
|
||||
'$percent%',
|
||||
style: TextStyle(
|
||||
fontSize: 12.5,
|
||||
height: 1.2,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: GcColors.accent,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: GcSpace.xs + 2),
|
||||
if (detail.isNotEmpty)
|
||||
Expanded(
|
||||
child: Text(
|
||||
detail,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
textAlign: TextAlign.right,
|
||||
style: TextStyle(
|
||||
fontSize: 11,
|
||||
height: 1.2,
|
||||
color: GcColors.faint,
|
||||
),
|
||||
),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () =>
|
||||
_jobAction(widget.controller.api.cancelJob, job.id),
|
||||
style: TextButton.styleFrom(
|
||||
minimumSize: const Size(0, 22),
|
||||
padding: const EdgeInsets.symmetric(horizontal: GcSpace.sm),
|
||||
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||
),
|
||||
child: Text(
|
||||
T('dl.cancel'),
|
||||
style: const TextStyle(fontSize: 11.5),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 3),
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.circular(3),
|
||||
child: LinearProgressIndicator(
|
||||
// 还没拿到进度时走不确定态,避免显示 0% 让人以为卡住
|
||||
value: value > 0 ? value : null,
|
||||
minHeight: 6,
|
||||
backgroundColor: GcColors.surfaceAlt,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user