- 添加 CodeGraph、Android 和通用 gitignore 配置 - 创建项目元数据文件跟踪 Flutter 项目属性 - 添加 Codex AI 指导文档 AGENTS.md 说明项目架构 - 配置代码分析选项 analysis_options.yaml - 设置 Android 应用清单权限和 Kiosk 模式配置 - 实现中英文国际化支持 AppLocalizations - 配置 GoRouter 应用路由导航 - 创建明亮工业控制风格的主题配置 AppTheme
55 lines
1.4 KiB
Dart
55 lines
1.4 KiB
Dart
import 'package:flutter/material.dart';
|
|
import '../../../core/theme/app_theme.dart';
|
|
|
|
/// 空状态组件
|
|
/// 统一的空数据展示样式
|
|
class EmptyStateWidget extends StatelessWidget {
|
|
final IconData icon;
|
|
final String message;
|
|
final String? actionText;
|
|
final VoidCallback? onAction;
|
|
|
|
const EmptyStateWidget({
|
|
super.key,
|
|
required this.icon,
|
|
required this.message,
|
|
this.actionText,
|
|
this.onAction,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Center(
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
Icon(
|
|
icon,
|
|
size: 64,
|
|
color: AppTheme.idleColor,
|
|
),
|
|
const SizedBox(height: 16),
|
|
Text(
|
|
message,
|
|
style: TextStyle(
|
|
color: AppTheme.textSecondary,
|
|
fontSize: 16,
|
|
),
|
|
),
|
|
if (actionText != null && onAction != null) ...[
|
|
const SizedBox(height: 24),
|
|
ElevatedButton.icon(
|
|
onPressed: onAction,
|
|
icon: const Icon(Icons.add, size: 20),
|
|
label: Text(actionText!),
|
|
style: ElevatedButton.styleFrom(
|
|
backgroundColor: AppTheme.primaryColor,
|
|
foregroundColor: Colors.white,
|
|
),
|
|
),
|
|
],
|
|
],
|
|
),
|
|
);
|
|
}
|
|
} |