openLoadingDialog static method

void openLoadingDialog(
  1. String text,
  2. String animation
)

Open a full-screen loading dialog with a given text and animation. This method doesn't return anything.

Parameters:

  • text: The text to be displayed in the loading dialog.
  • animation: The Lottie animation to be shown.

Implementation

static void openLoadingDialog(String text, String animation) {
  showDialog(
    context:
        Get.overlayContext!, // Use Get.overlayContext for overlay dialogs
    barrierDismissible:
        false, // The dialog can't be dismissed by tapping outside it
    builder: (_) => PopScope(
      canPop: false, // Disable popping with the back button
      child: Container(
        color: THelperFunctions.isDarkMode(Get.context!)
            ? TColors().darkBackground
            : TColors().white,
        width: double.infinity,
        height: double.infinity,
        child: Column(
          children: [
            const SizedBox(height: 250), // Adjust the spacing as needed
            TAnimationLoader(
                animation: animation, message: Text(text)),
          ],
        ),
      ),
    ),
  );
}