89 lines
2.6 KiB
Dart
89 lines
2.6 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
class EmptyState extends StatelessWidget {
|
|
final String title;
|
|
final String message;
|
|
final IconData icon;
|
|
final VoidCallback? onActionPressed;
|
|
final String? actionLabel;
|
|
|
|
const EmptyState({
|
|
super.key,
|
|
required this.title,
|
|
required this.message,
|
|
this.icon = Icons.inbox_outlined,
|
|
this.onActionPressed,
|
|
this.actionLabel,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Center(
|
|
child: Padding(
|
|
padding: EdgeInsets.all(32),
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
Container(
|
|
padding: EdgeInsets.all(32),
|
|
decoration: BoxDecoration(
|
|
gradient: LinearGradient(
|
|
begin: Alignment.topLeft,
|
|
end: Alignment.bottomRight,
|
|
colors: [Colors.blue.shade50, Colors.purple.shade50],
|
|
),
|
|
shape: BoxShape.circle,
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: Colors.black.withAlpha(15),
|
|
blurRadius: 20,
|
|
offset: Offset(0, 10),
|
|
),
|
|
],
|
|
),
|
|
child: Icon(icon, size: 80, color: Colors.deepPurple.shade300),
|
|
),
|
|
SizedBox(height: 32),
|
|
Text(
|
|
title,
|
|
textAlign: TextAlign.center,
|
|
style: TextStyle(
|
|
fontSize: 24,
|
|
fontWeight: FontWeight.bold,
|
|
color: Colors.deepPurple.shade700,
|
|
),
|
|
),
|
|
SizedBox(height: 12),
|
|
Text(
|
|
message,
|
|
textAlign: TextAlign.center,
|
|
style: TextStyle(
|
|
fontSize: 16,
|
|
color: Colors.grey.shade600,
|
|
height: 1.5,
|
|
),
|
|
),
|
|
if (onActionPressed != null && actionLabel != null) ...[
|
|
SizedBox(height: 32),
|
|
ElevatedButton.icon(
|
|
onPressed: onActionPressed,
|
|
icon: Icon(Icons.add),
|
|
label: Text(actionLabel!),
|
|
style: ElevatedButton.styleFrom(
|
|
backgroundColor: Colors.deepPurple.shade600,
|
|
foregroundColor: Colors.white,
|
|
padding: EdgeInsets.symmetric(horizontal: 24, vertical: 16),
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(12),
|
|
),
|
|
elevation: 4,
|
|
),
|
|
),
|
|
],
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|