noItemFoundUI method

Widget noItemFoundUI({
  1. required String msg,
  2. Alignment? containerAlignment,
  3. double? containerWidth,
  4. double? containerHeight,
  5. double? vwNoItemFoundBorderWidth,
  6. double? vwNoItemFoundBorderRadius,
  7. EdgeInsets? containerPadding,
  8. Color? vwNoItemFoundBgColor,
  9. Color? vwNoItemFoundBorderColor,
  10. Icon? noItemIcon,
  11. TextStyle? txtNoFollowingFoundStyle,
  12. TextAlign? textAlign,
})

Creates a "no items found" empty state UI with icon and message.

Displays a centered container with a "no items" icon and customizable message. Useful for empty lists, search results, or collections.

Parameters:

  • msg: The message to display to the user.
  • containerAlignment: Alignment of content within the container. Defaults to Alignment.center.
  • containerWidth: Width of the container. Defaults to Utils.appConstants.vwNoItemFoundWidth.
  • containerHeight: Height of the container. Defaults to Utils.appConstants.vwNoItemFoundHeight.
  • vwNoItemFoundBorderWidth: Border width. Defaults to Utils.appConstants.vwNoItemFoundBorderWidth.
  • vwNoItemFoundBorderRadius: Corner radius. Defaults to Utils.appConstants.vwNoItemFoundBorderRadius.
  • containerPadding: Internal padding. Defaults to Utils.appConstants.vwNoItemFoundPadding.
  • vwNoItemFoundBgColor: Background color. Defaults to Utils.appConstants.vwNoItemFoundBgColor.
  • vwNoItemFoundBorderColor: Border color. Defaults to Utils.appConstants.vwNoItemFoundBorderColor.
  • noItemIcon: Custom icon to display. Defaults to Utils.appConstants.imgNoItemFound.
  • txtNoFollowingFoundStyle: Text style for the message. Defaults to Utils.appConstants.txtNoFollowingFoundStyle.
  • textAlign: Text alignment. Defaults to TextAlign.center.

Returns a centered Container with the empty state UI.

The UI uses AutoSizeText to ensure the message fits within the available space.

Example:

noItemFoundUI(
  msg: 'No followers yet',
  vwNoItemFoundBgColor: Colors.grey[50],
  noItemIcon: Icon(Icons.people_outline, size: 64),
);

Implementation

Widget noItemFoundUI(
    {required String msg,
    Alignment? containerAlignment,
    double? containerWidth,
    double? containerHeight,
    double? vwNoItemFoundBorderWidth,
    double? vwNoItemFoundBorderRadius,
    EdgeInsets? containerPadding,
    Color? vwNoItemFoundBgColor,
    Color? vwNoItemFoundBorderColor,
    Icon? noItemIcon,
    TextStyle? txtNoFollowingFoundStyle,
    TextAlign? textAlign}) {
  return Center(
    child: Container(
      alignment: containerAlignment ?? Alignment.center,
      width: containerWidth ?? Utils.appConstants.vwNoItemFoundWidth,
      height: containerHeight ?? Utils.appConstants.vwNoItemFoundHeight,
      padding: containerPadding ?? Utils.appConstants.vwNoItemFoundPadding,
      decoration: BoxDecoration(
        color:
            vwNoItemFoundBgColor ?? Utils.appConstants.vwNoItemFoundBgColor,
        border: Border.all(
          color: vwNoItemFoundBorderColor ??
              Utils.appConstants.vwNoItemFoundBorderColor,
          width: vwNoItemFoundBorderWidth ??
              Utils.appConstants.vwNoItemFoundBorderWidth,
        ),
        borderRadius: BorderRadius.circular(vwNoItemFoundBorderRadius ??
            Utils.appConstants.vwNoItemFoundBorderRadius),
      ),
      child: Column(
        mainAxisSize: MainAxisSize.max,
        crossAxisAlignment: CrossAxisAlignment.center,
        mainAxisAlignment: MainAxisAlignment.spaceEvenly,
        children: [
          noItemIcon ?? Utils.appConstants.imgNoItemFound,
          AutoSizeText(
            msg,
            style: txtNoFollowingFoundStyle ??
                Utils.appConstants.txtNoFollowingFoundStyle,
            textAlign: textAlign ?? TextAlign.center,
          ),
        ],
      ),
    ),
  );
}