Overlayer.showOverlay constructor

Overlayer.showOverlay({
  1. int backgroundColor = 0x42000000,
  2. int seconds = 0,
  3. bool clickClose = false,
  4. bool allowClick = false,
  5. bool ignoreContentClick = false,
  6. bool crossPage = true,
  7. int animationMilliseconds = 200,
  8. int animationReverseMilliseconds = 200,
  9. BackButtonBehaviorChecker backButtonBehavior = BackButtonBehaviorChecker.none,
  10. void cancelFunc()?,
  11. required Widget child,
})

Constructs an OverLaymanager instance to show an overlay.

The overlay will display the given child widget and can be customized with various parameters.

  • backgroundColor: The background color of the overlay.
  • seconds: The duration for which the overlay will be displayed.
  • clickClose: Determines if clicking on the overlay will close it.
  • allowClick: Determines if clicking outside the overlay area will close it.
  • ignoreContentClick: Determines if clicking on the content within the overlay will be ignored.
  • crossPage: Determines if the overlay should persist across multiple pages.
  • animationMilliseconds: The duration for the overlay animation to complete when it appears.
  • animationReverseMilliseconds: The duration for the overlay animation to complete when it disappears.
  • backButtonBehavior: The behavior to apply when the back button is pressed.
  • cancelFunc: A callback function to be invoked when the overlay is closed.

Implementation

Overlayer.showOverlay({
  this.backgroundColor = 0x42000000,
  this.seconds = 0,
  this.clickClose = false,
  this.allowClick = false,
  this.ignoreContentClick = false,
  this.crossPage = true,
  this.animationMilliseconds = 200,
  this.animationReverseMilliseconds = 200,
  this.backButtonBehavior = BackButtonBehaviorChecker.none,
  this.cancelFunc,
  required Widget child,
}) {
  BotToast.showCustomLoading(
    clickClose: clickClose,
    allowClick: allowClick,
    backButtonBehavior:
        getBackButtonBehavior(backButtonBehavior: backButtonBehavior),
    ignoreContentClick: ignoreContentClick,
    animationDuration: Duration(milliseconds: animationMilliseconds),
    animationReverseDuration:
        Duration(milliseconds: animationReverseMilliseconds),
    duration: seconds == 0 ? null : Duration(seconds: seconds),
    backgroundColor: Color(backgroundColor),
    align: Alignment.center,
    toastBuilder: (cancelFuncval) {
      cancelFunc = cancelFuncval;
      return child;
    },
  );
}