showProgressDialog method

Future<void> showProgressDialog(
  1. String message,
  2. BuildContext context,
  3. bool dismissible,
  4. Widget? progressIndicator,
  5. TextStyle? textStyle,
  6. Color? dialogBackgroundColor,
)

Shows progress dialog

Implementation

Future<void> showProgressDialog(
    final String message,
    final BuildContext context,
    final bool dismissible,
    final Widget? progressIndicator,
    final TextStyle? textStyle,
    final Color? dialogBackgroundColor) {
  final Widget indicator = progressIndicator != null
      ? progressIndicator
      : CircularProgressIndicator(backgroundColor: Colors.orangeAccent);

  final style =
      textStyle != null ? textStyle : TextStyle(color: Colors.black);

  return showDialog(
    context: context,
    barrierDismissible: dismissible,
    builder: (BuildContext context) {
      return AlertDialog(
        backgroundColor: dialogBackgroundColor,
        content: Row(
          mainAxisAlignment: MainAxisAlignment.spaceEvenly,
          children: [
            indicator,
            Text(
              message,
              textAlign: TextAlign.center,
              style: style,
            )
          ],
        ),
      );
    },
  );
}