49 lines
1.2 KiB
Dart
49 lines
1.2 KiB
Dart
|
|
import 'package:flutter/material.dart';
|
||
|
|
|
||
|
|
class EmptyState extends StatelessWidget {
|
||
|
|
final IconData icon;
|
||
|
|
final String title;
|
||
|
|
final String? subtitle;
|
||
|
|
|
||
|
|
const EmptyState({
|
||
|
|
super.key,
|
||
|
|
required this.icon,
|
||
|
|
required this.title,
|
||
|
|
this.subtitle,
|
||
|
|
});
|
||
|
|
|
||
|
|
@override
|
||
|
|
Widget build(BuildContext context) {
|
||
|
|
final theme = Theme.of(context);
|
||
|
|
final muted = theme.colorScheme.onSurface.withValues(alpha: 0.4);
|
||
|
|
|
||
|
|
return Center(
|
||
|
|
child: Padding(
|
||
|
|
padding: const EdgeInsets.all(40),
|
||
|
|
child: Column(
|
||
|
|
mainAxisSize: MainAxisSize.min,
|
||
|
|
children: [
|
||
|
|
Icon(icon, size: 48, color: muted),
|
||
|
|
const SizedBox(height: 16),
|
||
|
|
Text(
|
||
|
|
title,
|
||
|
|
style: theme.textTheme.bodyLarge?.copyWith(color: muted),
|
||
|
|
textAlign: TextAlign.center,
|
||
|
|
),
|
||
|
|
if (subtitle != null) ...[
|
||
|
|
const SizedBox(height: 6),
|
||
|
|
Text(
|
||
|
|
subtitle!,
|
||
|
|
style: theme.textTheme.bodySmall?.copyWith(
|
||
|
|
color: theme.colorScheme.onSurface.withValues(alpha: 0.3),
|
||
|
|
),
|
||
|
|
textAlign: TextAlign.center,
|
||
|
|
),
|
||
|
|
],
|
||
|
|
],
|
||
|
|
),
|
||
|
|
),
|
||
|
|
);
|
||
|
|
}
|
||
|
|
}
|