getEmptyView method

Widget getEmptyView({
  1. required String title,
  2. required String msg,
  3. String? titleFontFamily,
  4. String? valueFontFamily,
  5. double? titleFontSize,
  6. double? valueFontSize,
  7. double? verticalSpace,
  8. double? iconSize,
  9. double? width,
  10. Color iconColor = Colors.blue,
  11. bool isTitleCenter = true,
  12. bool isValueCenter = true,
  13. Color titleTextColor = Colors.black,
  14. 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 to Utils.appConstants.boldFontFamily.
  • valueFontFamily: Font family for message. Defaults to Utils.appConstants.mediumFontFamily.
  • titleFontSize: Title font size. Defaults to Utils.appConstants.textButtonFontSize.
  • valueFontSize: Message font size. Defaults to Utils.appConstants.textSubHeaderFontSize.
  • verticalSpace: Spacing between elements. Defaults to Utils.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),
          ],
        ),
      ),
    ),
  ]);
}