empty_state.dart 861 B

12345678910111213141516171819202122232425262728293031323334
  1. import 'package:flutter/material.dart';
  2. import 'package:tdesign_flutter/tdesign_flutter.dart';
  3. class EmptyState extends StatelessWidget {
  4. final String message;
  5. final String? operationText;
  6. final VoidCallback? onTap;
  7. const EmptyState({
  8. super.key,
  9. required this.message,
  10. this.operationText,
  11. this.onTap,
  12. });
  13. @override
  14. Widget build(BuildContext context) {
  15. return Center(
  16. child: TDEmpty(
  17. type: onTap != null ? TDEmptyType.operation : TDEmptyType.plain,
  18. emptyText: message,
  19. operationText: operationText,
  20. onTapEvent: onTap,
  21. image: Container(
  22. margin: const EdgeInsets.only(bottom: 16),
  23. child: const TDImage(
  24. width: 120,
  25. assetUrl: 'assets/img/ic_empty.png',
  26. type: TDImageType.fitWidth,
  27. ),
  28. ),
  29. ),
  30. );
  31. }
  32. }