git-subtree-dir: app git-subtree-mainline:6ebd902c6bgit-subtree-split:a11a668869
34 lines
856 B
Dart
34 lines
856 B
Dart
import 'package:flutter/material.dart';
|
|
|
|
/// 空态 + 引导动作
|
|
class EmptyView extends StatelessWidget {
|
|
final String message;
|
|
final String? actionText;
|
|
final VoidCallback? onAction;
|
|
|
|
const EmptyView({
|
|
super.key,
|
|
required this.message,
|
|
this.actionText,
|
|
this.onAction,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Center(
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
Icon(Icons.inbox_outlined, size: 48, color: Colors.grey.shade400),
|
|
const SizedBox(height: 12),
|
|
Text(message, style: const TextStyle(color: Colors.grey)),
|
|
if (actionText != null && onAction != null) ...[
|
|
const SizedBox(height: 16),
|
|
FilledButton(onPressed: onAction, child: Text(actionText!)),
|
|
],
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|