showProgressDialog function

ProgressFuture showProgressDialog (
  1. {BuildContext context,
  2. Widget loading,
  3. String loadingText,
  4. TextStyle textStyle,
  5. Color backgroundColor,
  6. double radius,
  7. VoidCallback onDismiss,
  8. TextDirection textDirection,
  9. ProgressOrientation orientation}
)

show progress dialog with msg,

Implementation

ProgressFuture showProgressDialog({
  BuildContext context,
  Widget loading,
  String loadingText,
  TextStyle textStyle,
  Color backgroundColor,
  double radius,
  VoidCallback onDismiss,
  TextDirection textDirection,
  ProgressOrientation orientation,
}) {
  context ??= _contextMap.values.first;
  _ProgressTheme theme = _ProgressTheme.of(context);
  theme ??= _ProgressTheme.origin();
  textStyle ??= theme.textStyle ?? TextStyle(fontSize: 16.0);
  backgroundColor ??= theme.backgroundColor;
  radius ??= theme.radius;
  textDirection ??= theme.textDirection ?? TextDirection.ltr;
  orientation ??= theme.orientation;
  loading ??= theme.loading;
  loadingText ??= theme.loadingText ?? _defaultLoadingText;

  Widget widget = loading ??
      Container(
        margin: const EdgeInsets.all(50.0),
        padding: EdgeInsets.symmetric(horizontal: 24.0, vertical: 16.0),
        decoration: BoxDecoration(
            color: backgroundColor,
            borderRadius: BorderRadius.circular(radius)),
        child: ClipRect(
          child: orientation == ProgressOrientation.vertical
              ? Column(
                  mainAxisSize: MainAxisSize.min,
                  children: <Widget>[
                    Container(
                      width: 40.0,
                      height: 40.0,
                      margin: EdgeInsets.only(bottom: 8.0),
                      padding: EdgeInsets.all(4.0),
                      child: CircularProgressIndicator(strokeWidth: 3.0),
                    ),
                    Text(loadingText,
                        style: textStyle, textAlign: TextAlign.center),
                  ],
                )
              : Row(
                  mainAxisSize: MainAxisSize.min,
                  mainAxisAlignment: MainAxisAlignment.center,
                  children: <Widget>[
                    Container(
                      width: 36.0,
                      height: 36.0,
                      margin: EdgeInsets.only(right: 8.0),
                      padding: EdgeInsets.all(4.0),
                      child: CircularProgressIndicator(strokeWidth: 3.0),
                    ),
                    Text(loadingText,
                        style: textStyle, textAlign: TextAlign.center),
                  ],
                ),
        ),
      );

  return showProgressDialogWidget(
    widget,
    context: context,
    onDismiss: onDismiss,
    textDirection: textDirection,
  );
}