61 lines
1.6 KiB
Dart
61 lines
1.6 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
class EmptyStateWidget extends StatelessWidget {
|
|
const EmptyStateWidget({
|
|
super.key,
|
|
required this.icon,
|
|
required this.title,
|
|
required this.subtitle,
|
|
this.actionButton,
|
|
this.iconSize = 64.0,
|
|
});
|
|
|
|
final IconData icon;
|
|
final String title;
|
|
final String subtitle;
|
|
final Widget? actionButton;
|
|
final double iconSize;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final theme = Theme.of(context);
|
|
final colorScheme = theme.colorScheme;
|
|
|
|
return Center(
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(32.0),
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
Icon(
|
|
icon,
|
|
size: iconSize,
|
|
color: colorScheme.onSurfaceVariant.withOpacity(0.6),
|
|
),
|
|
const SizedBox(height: 24),
|
|
Text(
|
|
title,
|
|
style: theme.textTheme.headlineSmall?.copyWith(
|
|
color: colorScheme.onSurfaceVariant,
|
|
fontWeight: FontWeight.w600,
|
|
),
|
|
textAlign: TextAlign.center,
|
|
),
|
|
const SizedBox(height: 8),
|
|
Text(
|
|
subtitle,
|
|
style: theme.textTheme.bodyLarge?.copyWith(
|
|
color: colorScheme.onSurfaceVariant.withOpacity(0.7),
|
|
),
|
|
textAlign: TextAlign.center,
|
|
),
|
|
if (actionButton != null) ...[
|
|
const SizedBox(height: 32),
|
|
actionButton!,
|
|
],
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
} |