智慧水务管理系统 - 精河县供水工程综合管理平台

empty_state.dart 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import 'package:flutter/material.dart';
  2. /// 空状态占位组件
  3. class EmptyState extends StatelessWidget {
  4. final IconData icon;
  5. final String title;
  6. final String? subtitle;
  7. final Widget? action;
  8. const EmptyState({
  9. super.key,
  10. this.icon = Icons.inbox_outlined,
  11. required this.title,
  12. this.subtitle,
  13. this.action,
  14. });
  15. @override
  16. Widget build(BuildContext context) {
  17. return Center(
  18. child: Padding(
  19. padding: const EdgeInsets.all(32),
  20. child: Column(
  21. mainAxisSize: MainAxisSize.min,
  22. children: [
  23. Icon(icon, size: 64, color: Colors.grey.shade400),
  24. const SizedBox(height: 16),
  25. Text(title, style: TextStyle(fontSize: 16, color: Colors.grey.shade700)),
  26. if (subtitle != null) ...[
  27. const SizedBox(height: 8),
  28. Text(subtitle!, style: TextStyle(fontSize: 13, color: Colors.grey.shade500)),
  29. ],
  30. if (action != null) ...[
  31. const SizedBox(height: 24),
  32. action!,
  33. ],
  34. ],
  35. ),
  36. ),
  37. );
  38. }
  39. }