emptyRecordsView method

Widget emptyRecordsView({
  1. String title = "No results found",
  2. String description = "",
  3. Color titleTextColor = Colors.black,
  4. Color descriptionTextColor = Colors.black,
})

Displays an empty state view when no records are found.

This widget provides a user-friendly empty state with customizable title and description. It's centered on the screen and commonly used in list views or data grids when no data is available.

Parameters:

  • title: The main heading text (defaults to "No results found").
  • description: Optional descriptive text providing additional context.
  • titleTextColor: Color for the title text (defaults to black).
  • descriptionTextColor: Color for the description text (defaults to black).

Returns a centered Column with the title and description.

Example:

emptyRecordsView(
  title: 'No Tasks Found',
  description: 'Create your first task to get started',
  titleTextColor: Colors.grey[800],
  descriptionTextColor: Colors.grey[600],
);

Implementation

Widget emptyRecordsView(
    {String title = "No results found",
    String description = "",
    Color titleTextColor = Colors.black,
    Color descriptionTextColor = Colors.black}) {
  return Center(
    child: Column(
      mainAxisAlignment: MainAxisAlignment.center,
      children: [
        /*Image.asset(imgNoPhotosYet),*/
        SizedBox(height: Utils.appConstants.twenty),
        Text(
          title,
          style: TextStyle(
            color: titleTextColor,
            fontSize: Utils.appConstants.textButtonFontSize,
          ),
        ),
        SizedBox(height: Utils.appConstants.eight),
        Text(
          description,
          style: TextStyle(
            color: descriptionTextColor,
            fontSize: Utils.appConstants.textSubHeaderFontSize,
          ),
        ),
      ],
    ),
  );
}