fix: 模组/终端页空状态改为统一引导页(带标题栏)
This commit is contained in:
1 parent
132769e156
commit
6786e62263
3 files changed
+80
-35
No files matched your search
@@ -0,0 +1,64 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../core/l10n/strings.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: AppBar(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!),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user