import 'package:flutter/material.dart'; class AppEmptyView extends StatelessWidget { const AppEmptyView({ super.key, this.title = '暂无数据', this.message, this.icon = Icons.inbox_outlined, this.action, }); final String title; final String? message; final IconData icon; final Widget? action; @override Widget build(BuildContext context) { final colors = Theme.of(context).colorScheme; return Center( child: Padding( padding: const EdgeInsets.all(24), child: Column( mainAxisSize: MainAxisSize.min, children: [ Icon(icon, size: 56, color: colors.outline), const SizedBox(height: 12), Text(title, style: Theme.of(context).textTheme.titleMedium), if (message != null) ...[ const SizedBox(height: 6), Text( message!, textAlign: TextAlign.center, style: Theme.of(context).textTheme.bodyMedium?.copyWith( color: colors.onSurfaceVariant, ), ), ], if (action != null) ...[const SizedBox(height: 16), action!], ], ), ), ); } }