getLoadingWidget method

Widget getLoadingWidget({
  1. String? loadingMsg,
  2. Color textColor = Colors.black,
})

Creates a loading indicator widget with optional text.

Displays a centered text message to indicate loading state. This widget is typically used during asynchronous operations or data fetching.

Parameters:

  • loadingMsg: Optional custom loading message. Defaults to strLoadingText from app strings.
  • textColor: Color of the loading text (defaults to black).

Returns a centered Text widget displaying the loading message.

Example:

getLoadingWidget(
  loadingMsg: 'Fetching data...',
  textColor: Colors.blue,
);

Implementation

Widget getLoadingWidget(
    {String? loadingMsg, Color textColor = Colors.black}) {
  return Center(
    child: Text(
      loadingMsg ?? strLoadingText,
      style: TextStyle(color: textColor),
    ),
  );
}