showLoadingDialog function

void showLoadingDialog(
  1. BuildContext context, {
  2. Color? color,
})

Implementation

void showLoadingDialog(BuildContext context, {Color? color}) {
  showDialog(
    context: context,
    barrierDismissible: false,
    builder: (ctx) {
      return PopScope(
        //Prevent Back press on Android devices
        canPop: false,
        child: Dialog(
          backgroundColor: Colors.transparent,
          shadowColor: Colors.transparent,
          child: Padding(
            padding: EdgeInsets.all(16),
            child: SizedBox(
              width: 48,
              height: 48,
              child: Center(
                child: CircularProgressIndicator(
                  color: color ?? Theme.of(context).primaryColor,
                ),
              ),
            ),
          ),
        ),
      );
    },
  );
}