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>
66 lines
1.9 KiB
Dart
66 lines
1.9 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import '../../core/l10n/strings.dart';
|
|
import '../widgets/z_widgets.dart';
|
|
|
|
/// 统一的「需要先选服务器 / 未配置」引导空状态页。
|
|
/// 自带 AppBar 标题栏,避免页面看起来空白、引导文字无处安放。
|
|
class EmptyStatePage extends StatelessWidget {
|
|
final String title;
|
|
final IconData icon;
|
|
final String message;
|
|
final String? actionLabel;
|
|
final VoidCallback? onAction;
|
|
|
|
const EmptyStatePage({
|
|
super.key,
|
|
required this.title,
|
|
required this.icon,
|
|
required this.message,
|
|
this.actionLabel,
|
|
this.onAction,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final theme = Theme.of(context);
|
|
return Scaffold(
|
|
appBar: ZAppBar(title: T(title)),
|
|
body: Center(
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(32),
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
Container(
|
|
width: 72,
|
|
height: 72,
|
|
decoration: BoxDecoration(
|
|
color: theme.colorScheme.primary.withOpacity(0.12),
|
|
borderRadius: BorderRadius.circular(20),
|
|
),
|
|
child: Icon(icon,
|
|
size: 36, color: theme.colorScheme.primary),
|
|
),
|
|
const SizedBox(height: 16),
|
|
Text(
|
|
S.t(message),
|
|
textAlign: TextAlign.center,
|
|
style: theme.textTheme.bodyMedium
|
|
?.copyWith(color: theme.hintColor, height: 1.6),
|
|
),
|
|
if (actionLabel != null && onAction != null) ...[
|
|
const SizedBox(height: 20),
|
|
FilledButton.tonal(
|
|
onPressed: onAction,
|
|
child: T(actionLabel!),
|
|
),
|
|
],
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|