showLoading function

void showLoading(
  1. BuildContext context, {
  2. Widget? child,
  3. ThemeData? theme,
  4. bool? isDarkMode,
  5. String? text,
})

Implementation

void showLoading(
  BuildContext context, {
  Widget? child,
  ThemeData? theme,
  bool? isDarkMode,
  String? text,
}) {
  child ??= EConfig.instance.getLoadingWidget(context);
  theme ??= Theme.of(context);
  showDialog(
    context: context,
    barrierDismissible: true, // user must tap button!
    builder: (BuildContext context) {
      return Theme(
        data: theme!,
        child: WillPopScope(
          onWillPop: () async {
            return Future.value(false);
          },
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              child!,
              text == null
                  ? Container()
                  : DefaultTextStyle(
                      style: TextStyle(
                          fontSize: MediaQuery.of(context).size.width * 0.05,
                          color: Colors.white),
                      child: Text(text),
                    )
            ],
          ),
        ),
      );
    },
  );
  _isShowing = true;
  // _allowPop = false;
}