Files
trainhub-flutter/lib/presentation/common/widgets/app_empty_state.dart
Kazimierz Ciołek 782986a632 Initial commit
2026-02-19 02:49:29 +01:00

95 lines
2.9 KiB
Dart

import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:trainhub_flutter/core/constants/ui_constants.dart';
import 'package:trainhub_flutter/core/theme/app_colors.dart';
class AppEmptyState extends StatelessWidget {
const AppEmptyState({
super.key,
required this.icon,
required this.title,
this.subtitle,
this.actionLabel,
this.onAction,
});
final IconData icon;
final String title;
final String? subtitle;
final String? actionLabel;
final VoidCallback? onAction;
@override
Widget build(BuildContext context) {
return Center(
child: Padding(
padding: const EdgeInsets.all(UIConstants.pagePadding),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Container(
width: 64,
height: 64,
decoration: BoxDecoration(
color: AppColors.surfaceContainer,
borderRadius: BorderRadius.circular(UIConstants.borderRadius),
border: Border.all(color: AppColors.border),
),
child: Icon(
icon,
size: 28,
color: AppColors.textMuted,
),
),
const SizedBox(height: UIConstants.spacing16),
Text(
title,
style: GoogleFonts.inter(
fontSize: 16,
fontWeight: FontWeight.w600,
color: AppColors.textPrimary,
),
textAlign: TextAlign.center,
),
if (subtitle != null) ...[
const SizedBox(height: UIConstants.spacing8),
Text(
subtitle!,
style: GoogleFonts.inter(
fontSize: 14,
color: AppColors.textSecondary,
),
textAlign: TextAlign.center,
),
],
if (actionLabel != null && onAction != null) ...[
const SizedBox(height: UIConstants.spacing24),
FilledButton(
onPressed: onAction,
style: FilledButton.styleFrom(
backgroundColor: AppColors.accent,
foregroundColor: AppColors.zinc950,
shape: RoundedRectangleBorder(
borderRadius: UIConstants.smallCardBorderRadius,
),
padding: const EdgeInsets.symmetric(
horizontal: UIConstants.spacing24,
vertical: UIConstants.spacing12,
),
),
child: Text(
actionLabel!,
style: GoogleFonts.inter(
fontSize: 14,
fontWeight: FontWeight.w600,
),
),
),
],
],
),
),
);
}
}