showWaitingDialog function

void showWaitingDialog (
  1. {@required BuildContext context,
  2. @required WaitingCallback onWaiting,
  3. Color backgroundColor,
  4. Color color,
  5. double strokeWidth: 8.0,
  6. VoidCallback onDone}
)

Implementation

void showWaitingDialog(
    {@required BuildContext context,
    @required WaitingCallback onWaiting,
    Color backgroundColor,
    Color color,
    double strokeWidth: 8.0,
    VoidCallback onDone}) async {
  assert(context != null);
  assert(onWaiting != null);
  ThemeData theme = Theme.of(context);
  backgroundColor = backgroundColor ?? theme.dialogBackgroundColor;
  color = color ?? theme.primaryColor;
  var w = Waiting(
    backgroundColor: backgroundColor,
    color: color,
    strokeWidth: strokeWidth,
  );
  showDialog(context: context, builder: (_) => w);
  await onWaiting().then((_) {
    w.pop(context);
    if (onDone != null) onDone();
  });
}