showProgressDialog function

Future<void> showProgressDialog(
  1. BuildContext context, {
  2. String? message,
  3. required Color textColor,
  4. Color? barrierColor = Colors.black54,
  5. Color? backgroundColor = Colors.white,
  6. void onPressed()?,
})

Displays a loading/progress dialog.

message is an optional loading message. textColor controls the message text color. barrierColor and backgroundColor style the dialog. onPressed is an optional callback for additional actions.

Implementation

Future<void> showProgressDialog(
  BuildContext context, {
  String? message,
  required Color textColor,
  Color? barrierColor = Colors.black54,
  Color? backgroundColor = Colors.white,
  void Function()? onPressed,
}) {
  return baseDialog(
    context,
    barrierColor: barrierColor,
    backgroundColor: backgroundColor,
    content: Row(
      children: [
        const CircularProgressIndicator(),
        Container(
          margin: const EdgeInsets.only(left: 12.0),
          child: Text(
            message ?? '',
            style: TextStyle(color: textColor),
          ),
        ),
      ],
    ),
  );
}