show<T> static method

Future<T?> show<T>(
  1. BuildContext context, {
  2. bool disablePop = true,
  3. Color? barrierColor,
  4. Widget? child,
  5. Color loadingColor = Colors.white,
})

Implementation

static Future<T?> show<T>(
  BuildContext context, {
  bool disablePop = true,
  Color? barrierColor,
  Widget? child,
  Color loadingColor = Colors.white,
}) async {
  return showDialog(
    barrierColor: barrierColor,
    useRootNavigator: false,
    context: context,
    barrierDismissible: false,
    builder: (context) {
      return Builder(
        builder: (context) => WillPopScope(
          onWillPop: !disablePop ? null : () async => Future.value(false),
          child: Material(
            color: Colors.transparent,
            child: child ??
                Container(
                  width: MediaQuery.of(context).size.width,
                  height: MediaQuery.of(context).size.height,
                  child: Center(
                    child: CircularProgressIndicator(
                      valueColor: AlwaysStoppedAnimation<Color>(loadingColor),
                    ),
                  ),
                ),
          ),
        ),
      );
    },
  );
}