showProgressDialog static method

void showProgressDialog({
  1. BuildContext? context,
  2. dynamic isCancellable = false,
})

common method for showing progress dialog

Implementation

static void showProgressDialog(
    {BuildContext? context, isCancellable = false}) async {
  if (!isProgressVisible &&
      NavigatorService.navigatorKey.currentState?.overlay?.context != null) {
    showDialog(
        barrierDismissible: isCancellable,
        context: NavigatorService.navigatorKey.currentState!.overlay!.context,
        builder: (BuildContext context) {
          return const Center(
            child: CircularProgressIndicator.adaptive(
              strokeWidth: 4,
              valueColor: AlwaysStoppedAnimation<Color>(
                Colors.white,
              ),
            ),
          );
        });
    isProgressVisible = true;
  }
}