示例工程 ch16-bookmarks
ch16-bookmarks/lib/src/presentation/widgets/empty_state.dart
import 'package:flutter/material.dart';
class EmptyState extends StatelessWidget {
const EmptyState({super.key, required this.message, required this.hint});
final String message;
final String hint;
@override
Widget build(BuildContext context) {
final ThemeData theme = Theme.of(context);
return Center(
child: Padding(
padding: const EdgeInsets.all(32),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Icon(Icons.bookmark_border, size: 56, color: theme.colorScheme.outline),
const SizedBox(height: 12),
Text(message, key: const Key('empty-message'), textAlign: TextAlign.center),
const SizedBox(height: 4),
Text(
hint,
key: const Key('empty-hint'),
textAlign: TextAlign.center,
style: theme.textTheme.bodySmall,
),
],
),
),
);
}
}