login-page/lib/widgets/empty_state_widget.dart
2025-05-17 11:13:16 +03:00

52 lines
1.4 KiB
Dart

import 'package:flutter/material.dart';
class EmptyStateWidget extends StatelessWidget {
final IconData icon;
final String message;
final String? actionButtonText;
final VoidCallback? onActionButtonPressed;
const EmptyStateWidget({
super.key,
required this.icon,
required this.message,
this.actionButtonText,
this.onActionButtonPressed,
});
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
return Center(
child: Padding(
padding: const EdgeInsets.all(20.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Icon(
icon,
size: 80,
color: theme.textTheme.bodySmall?.color?.withOpacity(0.6),
),
const SizedBox(height: 20),
Text(
message,
textAlign: TextAlign.center,
style: theme.textTheme.titleLarge?.copyWith(
color: theme.textTheme.bodyMedium?.color?.withOpacity(0.8),
),
),
if (actionButtonText != null && onActionButtonPressed != null) ...[
const SizedBox(height: 24),
ElevatedButton(
onPressed: onActionButtonPressed,
child: Text(actionButtonText!),
),
]
],
),
),
);
}
}