didvan-app/lib/views/widgets/state_handlers/empty_state.dart

55 lines
1.5 KiB
Dart

import 'package:didvan/config/theme_data.dart';
import 'package:didvan/views/widgets/didvan/button.dart';
import 'package:didvan/views/widgets/didvan/text.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
class EmptyState extends StatelessWidget {
final String asset;
final String title;
final String? subtitle;
final String? buttonTitle;
final VoidCallback? action;
final Color? titleColor;
const EmptyState({
Key? key,
required this.asset,
required this.title,
this.action,
this.buttonTitle,
this.subtitle,
this.titleColor,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
SizedBox(height: 210, child: SvgPicture.asset(asset)),
const SizedBox(height: 16),
DidvanText(
title,
style: Theme.of(context).textTheme.displaySmall,
color: titleColor ?? Theme.of(context).colorScheme.caption,
),
if (subtitle != null) const SizedBox(height: 8),
if (subtitle != null)
DidvanText(
subtitle!,
color: Theme.of(context).colorScheme.caption,
),
if (action != null) const SizedBox(height: 16),
if (action != null)
DidvanButton(
height: 40,
onPressed: action,
title: buttonTitle,
width: 112,
),
],
);
}
}