api修改和更新检查器修改
modrinth_api.dart:拦截器改为只替换 options.baseUrl,path 保持相对 /v2/search、query 留在 queryParameters,避免"整串写回 path"导致的 host 缺失 + query 重复拼接。mirror_service.dart:新增 apiBase getter,返回当前镜像的 API base(official→api.modrinth.com、mcim→modrinth-api.mcimirror.top、custom→自定义 base) Signed-off-by: driftinblock <3480428251@qq.com>
This commit is contained in:
35 files changed
+4171
-1325
No files matched your search
@@ -1,9 +1,16 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:package_info_plus/package_info_plus.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../core/l10n/strings.dart';
|
||||
import '../../core/utils/update_service.dart';
|
||||
import '../../core/widgets/z_widgets.dart';
|
||||
import '../../providers/wallpaper_provider.dart';
|
||||
|
||||
/// 关于软件页:版本与检查更新 + 开发者信息 + 开源许可。
|
||||
///
|
||||
/// 版式:顶部 Logo 区 → 「应用」面板(检查更新 / 开源许可)→
|
||||
/// 「创造者」面板(头像行)→ 底部免责说明。
|
||||
class AboutPage extends StatefulWidget {
|
||||
const AboutPage({super.key});
|
||||
|
||||
@@ -55,68 +62,70 @@ class _AboutPageState extends State<AboutPage> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final hasWallpaper = context.watch<WallpaperProvider>().hasWallpaper;
|
||||
final st = ZStyle.of(context, hasWallpaper: hasWallpaper);
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: T('关于软件')),
|
||||
backgroundColor: hasWallpaper ? Colors.transparent : null,
|
||||
appBar: ZAppBar(
|
||||
title: T('关于软件'),
|
||||
backgroundColor: hasWallpaper ? Colors.transparent : null,
|
||||
),
|
||||
body: ListView(
|
||||
padding: const EdgeInsets.fromLTRB(16, 12, 16, 28),
|
||||
children: [
|
||||
const SizedBox(height: 24),
|
||||
Column(
|
||||
children: [
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
child: Image.asset('assets/logo.png', width: 96, height: 96),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
T('ZV Manager', style: Theme.of(context).textTheme.titleLarge),
|
||||
Text(S.f('版本 {0}', [_currentVersion]),
|
||||
style: Theme.of(context).textTheme.bodySmall),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
const Divider(),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.system_update_outlined),
|
||||
title: T('检查更新'),
|
||||
trailing: _checkingUpdate
|
||||
? const SizedBox(
|
||||
width: 20,
|
||||
height: 20,
|
||||
child: CircularProgressIndicator(strokeWidth: 2))
|
||||
: const Icon(Icons.chevron_right),
|
||||
onTap: _checkingUpdate ? null : _checkUpdate,
|
||||
),
|
||||
const Divider(),
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 12, 16, 4),
|
||||
child: T('创造者', style: Theme.of(context).textTheme.titleSmall),
|
||||
),
|
||||
const _CreatorTile(
|
||||
name: 'Z有3笔',
|
||||
role: '开发者 · Gitee: DriftinBlock',
|
||||
assetAvatar: 'assets/creator_zavatar.png',
|
||||
homeUrl: 'https://gitee.com/driftinblock',
|
||||
),
|
||||
_CreatorTile(
|
||||
name: 'Ventiの酒',
|
||||
role: S.t('协作者 · Gitee: venti1112'),
|
||||
avatarUrl: 'https://gitee.com/venti1112.png',
|
||||
homeUrl: 'https://gitee.com/venti1112',
|
||||
),
|
||||
const Divider(),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.fact_check_outlined),
|
||||
title: T('开源许可'),
|
||||
trailing: const Icon(Icons.chevron_right),
|
||||
onTap: () => showLicensePage(context: context),
|
||||
),
|
||||
const Divider(),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Text(
|
||||
S.t('ZV Manager 是一款 Minecraft 服务器远程管理工具,本软件与 Mojang、微软无任何隶属关系。'),
|
||||
style: Theme.of(context).textTheme.bodySmall,
|
||||
textAlign: TextAlign.center,
|
||||
_Header(version: _currentVersion, style: st),
|
||||
const SizedBox(height: 20),
|
||||
ZPanel(style: st, children: [
|
||||
ZRow(
|
||||
title: '检查更新',
|
||||
subtitle: '从 Gitee 获取最新版本',
|
||||
style: st,
|
||||
leading: Icon(Icons.system_update_outlined,
|
||||
size: 20, color: st.subColor),
|
||||
trailing: _checkingUpdate
|
||||
? const SizedBox(
|
||||
width: 18,
|
||||
height: 18,
|
||||
child: CircularProgressIndicator(strokeWidth: 2))
|
||||
: null,
|
||||
onTap: _checkingUpdate ? null : _checkUpdate,
|
||||
),
|
||||
ZDivider(style: st),
|
||||
ZRow(
|
||||
title: '开源许可',
|
||||
subtitle: '查看本应用使用的第三方库许可',
|
||||
style: st,
|
||||
leading: Icon(Icons.fact_check_outlined,
|
||||
size: 20, color: st.subColor),
|
||||
onTap: () => showLicensePage(context: context),
|
||||
),
|
||||
]),
|
||||
const SizedBox(height: 14),
|
||||
_SectionLabel('创造者', style: st),
|
||||
ZPanel(style: st, children: [
|
||||
_CreatorRow(
|
||||
style: st,
|
||||
name: 'Z有3笔',
|
||||
role: S.t('开发者 · Gitee: DriftinBlock'),
|
||||
assetAvatar: 'assets/creator_zavatar.png',
|
||||
homeUrl: 'https://gitee.com/driftinblock',
|
||||
),
|
||||
ZDivider(style: st),
|
||||
_CreatorRow(
|
||||
style: st,
|
||||
name: 'Ventiの酒',
|
||||
role: S.t('协作者 · Gitee: venti1112'),
|
||||
avatarUrl: 'https://gitee.com/venti1112.png',
|
||||
homeUrl: 'https://gitee.com/venti1112',
|
||||
),
|
||||
]),
|
||||
const SizedBox(height: 22),
|
||||
Text(
|
||||
S.t('ZV Manager 是一款 Minecraft 服务器远程管理工具,'
|
||||
'本软件与 Mojang、微软无任何隶属关系。'),
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(fontSize: 12, height: 1.6, color: st.subColor),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -124,8 +133,65 @@ class _AboutPageState extends State<AboutPage> {
|
||||
}
|
||||
}
|
||||
|
||||
/// 创造者条目:头像 + 名称 + 角色,点击打开 Gitee 主页。
|
||||
class _CreatorTile extends StatelessWidget {
|
||||
/// 顶部品牌区:Logo + 名称 + 版本号。
|
||||
class _Header extends StatelessWidget {
|
||||
final String version;
|
||||
final ZStyle style;
|
||||
const _Header({required this.version, required this.style});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
children: [
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.circular(22),
|
||||
child: Image.asset('assets/logo.png', width: 88, height: 88),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Text(
|
||||
'ZV Manager',
|
||||
style: TextStyle(
|
||||
fontSize: 19,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: style.titleColor,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 3),
|
||||
Text(
|
||||
S.f('版本 {0}', [version]),
|
||||
style: TextStyle(fontSize: 12.5, color: style.subColor),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// 分组小标题(面板外的灰色小字)。
|
||||
class _SectionLabel extends StatelessWidget {
|
||||
final String text;
|
||||
final ZStyle style;
|
||||
const _SectionLabel(this.text, {required this.style});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.fromLTRB(6, 0, 6, 8),
|
||||
child: Text(
|
||||
S.t(text),
|
||||
style: TextStyle(
|
||||
fontSize: 12.5,
|
||||
fontWeight: FontWeight.w700,
|
||||
letterSpacing: 0.2,
|
||||
color: style.subColor,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// 创造者行:头像 + 名称 + 角色,点击打开 Gitee 主页。
|
||||
class _CreatorRow extends StatelessWidget {
|
||||
final ZStyle style;
|
||||
final String name;
|
||||
final String role;
|
||||
final String homeUrl;
|
||||
@@ -134,7 +200,8 @@ class _CreatorTile extends StatelessWidget {
|
||||
final String? assetAvatar;
|
||||
final String? avatarUrl;
|
||||
|
||||
const _CreatorTile({
|
||||
const _CreatorRow({
|
||||
required this.style,
|
||||
required this.name,
|
||||
required this.role,
|
||||
required this.homeUrl,
|
||||
@@ -144,24 +211,27 @@ class _CreatorTile extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListTile(
|
||||
return ZRow(
|
||||
style: style,
|
||||
title: name,
|
||||
subtitle: role,
|
||||
leading: ClipOval(
|
||||
child: SizedBox(
|
||||
width: 44,
|
||||
height: 44,
|
||||
width: 38,
|
||||
height: 38,
|
||||
child: assetAvatar != null
|
||||
? Image.asset(assetAvatar!, fit: BoxFit.cover)
|
||||
: Image.network(
|
||||
avatarUrl!,
|
||||
fit: BoxFit.cover,
|
||||
errorBuilder: (_, __, ___) => const ColoredBox(
|
||||
color: Color(0xFFDDDDDD), child: Icon(Icons.person)),
|
||||
errorBuilder: (_, __, ___) => ColoredBox(
|
||||
color: style.scheme.surfaceContainerHighest,
|
||||
child: Icon(Icons.person,
|
||||
size: 20, color: style.scheme.onSurfaceVariant),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
title: Text(name),
|
||||
subtitle: Text(role, overflow: TextOverflow.ellipsis),
|
||||
trailing: const Icon(Icons.open_in_new, size: 18),
|
||||
onTap: () => UpdateService.openUrl(homeUrl),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user