show static method

void show({
  1. BuildContext? context,
  2. bool showProgress = false,
  3. Duration? duration,
  4. bool canCancelLoading = false,
})

Implementation

static void show({
  BuildContext? context,
  bool showProgress = false,
  Duration? duration,
  bool canCancelLoading = false,
}) {
  if (context != null) {
    FocusScope.of(context).requestFocus(FocusNode());
  }
  if (canCancelLoading) {
    loaderVisible = false;
  } else {
    loaderVisible = true;
  }
  if (cancelFunc != null) {
    cancelFunc!.call();
  }
  cancelFunc = BotToast.showCustomLoading(
    duration: duration,
    toastBuilder: (CancelFunc toastCancelFunc) {
      return Container(
        padding: EdgeInsets.zero,
        decoration: BoxDecoration(
          color: AppColors.white,
          boxShadow: [
            BoxShadow(
              color: AppColors.grey.withOpacity(0.50),
              blurRadius: 4,
              spreadRadius: 0,
              offset: const Offset(0, 1),
            ),
          ],
          borderRadius: BorderRadius.circular(16),
        ),
        child: Wrap(
          children: [
            Padding(
              padding: const EdgeInsets.only(
                right: 20.0,
                left: 20,
                top: 20,
                bottom: 5,
              ),
              child: Column(
                crossAxisAlignment: CrossAxisAlignment.center,
                mainAxisAlignment: MainAxisAlignment.center,
                children: [
                  const SizedBox(
                    height: 70,
                    width: 70,
                    child: LoadingIndicator(
                      indicatorType: Indicator.ballClipRotateMultiple,
                      colors: [AppColors.primary],
                      strokeWidth: 3,
                      pathBackgroundColor: Colors.black,
                    ),
                  ),
                ],
              ),
            ),
          ],
        ),
      );
    },
    backgroundColor: AppColors.white.withOpacity(.50),
  );
}