show static method

Future<void> show(
  1. BuildContext context,
  2. {required GlobalKey<State<StatefulWidget>> keyLoader}
)

Shows a dialog with a progress indicator, used to indicate loading while blocking the user's interaction with the app.

Typically used where the completion of this action is necessary and should not be interrupted by the user (like a transaction, or saving an important and required file).

Implementation

static Future<void> show(BuildContext context, {required GlobalKey keyLoader}) async {
  await showDialog<void>(
    barrierDismissible: false,
    context: context,
    useRootNavigator: false,
    builder: (BuildContext context) {
      return Dialog(
        backgroundColor: Colors.transparent,
        elevation: 0,
        key: keyLoader,
        insetPadding: EdgeInsets.zero,
        clipBehavior: Clip.antiAliasWithSaveLayer,
        shape: const RoundedRectangleBorder(
          borderRadius: BorderRadius.all(Radius.circular(10)),
        ),
        child: const Center(
          child: SizedBox(
            height: 80,
            width: 80,
            child: ZdsCard(
              padding: EdgeInsets.all(10),
              child: Center(
                child: SizedBox(
                  width: 32,
                  height: 32,
                  child: CircularProgressIndicator(strokeWidth: 3),
                ),
              ),
            ),
          ),
        ),
      );
    },
  );
}