import 'package:flutter/material.dart'; import 'package:shadcn_ui/shadcn_ui.dart'; /// 统一空状态占位组件 class AppEmptyState extends StatelessWidget { final IconData icon; final String title; final String? subtitle; final Widget? action; const AppEmptyState({ super.key, required this.icon, required this.title, this.subtitle, this.action, }); @override Widget build(BuildContext context) { final theme = ShadTheme.of(context); return Center( child: Padding( padding: const EdgeInsets.all(48), child: Column( mainAxisSize: MainAxisSize.min, children: [ Container( width: 80, height: 80, decoration: BoxDecoration( color: theme.colorScheme.muted, borderRadius: BorderRadius.circular(40), ), child: Icon(icon, size: 36, color: theme.colorScheme.mutedForeground), ), const SizedBox(height: 20), Text(title, style: TextStyle(fontSize: 20, fontWeight: FontWeight.w600, color: theme.colorScheme.foreground)), if (subtitle != null) ...[ const SizedBox(height: 6), Text(subtitle!, style: TextStyle(fontSize: 17, color: theme.colorScheme.mutedForeground), textAlign: TextAlign.center), ], if (action != null) ...[ const SizedBox(height: 20), action!, ], ], ), ), ); } }