getEmptyView method
Widget
getEmptyView({
- required String title,
- required String msg,
- String? titleFontFamily,
- String? valueFontFamily,
- double? titleFontSize,
- double? valueFontSize,
- double? verticalSpace,
- double? iconSize,
- double? width,
- Color iconColor = Colors.blue,
- bool isTitleCenter = true,
- bool isValueCenter = true,
- Color titleTextColor = Colors.black,
- Color valueTextColor = Colors.black,
Creates an empty state view with title, icon, and message.
This comprehensive empty state widget displays when no content is available, featuring a title, cloud icon, and descriptive message in an elevated card.
Parameters:
title: The main heading text.msg: The descriptive message explaining the empty state.titleFontFamily: Font family for title. Defaults toUtils.appConstants.boldFontFamily.valueFontFamily: Font family for message. Defaults toUtils.appConstants.mediumFontFamily.titleFontSize: Title font size. Defaults toUtils.appConstants.textButtonFontSize.valueFontSize: Message font size. Defaults toUtils.appConstants.textSubHeaderFontSize.verticalSpace: Spacing between elements. Defaults toUtils.appConstants.zeroPointZeroOne.iconSize: Size of the empty state icon.width: Container width. Defaults to full screen width.iconColor: Color of the cloud icon (defaults to blue).isTitleCenter: Whether to center the title (defaults to true).isValueCenter: Whether to center the message (defaults to true).titleTextColor: Title text color (defaults to black).valueTextColor: Message text color (defaults to black).
Returns a Wrap containing an elevated box with the empty state content.
Example:
getEmptyView(
title: 'No Items',
msg: 'There are no items to display at this time',
iconColor: Colors.grey,
iconSize: 64,
);
Implementation
Widget getEmptyView(
{required String title,
required String msg,
String? titleFontFamily,
String? valueFontFamily,
double? titleFontSize,
double? valueFontSize,
double? verticalSpace,
double? iconSize,
double? width,
Color iconColor = Colors.blue,
bool isTitleCenter = true,
bool isValueCenter = true,
Color titleTextColor = Colors.black,
Color valueTextColor = Colors.black}) {
return Wrap(children: [
getBoxWithElevation(
child: SizedBox(
width: width ?? Get.width,
child: Column(
children: [
setText(
title,
titleFontFamily ?? Utils.appConstants.boldFontFamily,
titleTextColor,
titleFontSize ?? Utils.appConstants.textButtonFontSize,
isCenter: isTitleCenter),
addVerticalSpace(
verticalSpace ?? Utils.appConstants.zeroPointZeroOne),
Icon(
Icons.cloud_off, // Use a cloud icon with an "X"
size: iconSize, color: iconColor,
),
addVerticalSpace(
verticalSpace ?? Utils.appConstants.zeroPointZeroOne),
setText(
msg,
valueFontFamily ?? Utils.appConstants.mediumFontFamily,
valueTextColor,
valueFontSize ?? Utils.appConstants.textSubHeaderFontSize,
isCenter: isValueCenter),
],
),
),
),
]);
}