Modal class
Properties
-
hashCode
→ int
-
The hash code for this object.
no setterinherited
-
runtimeType
→ Type
-
A representation of the runtime type of the object.
no setterinherited
Static Methods
-
appBuilder(BuildContext context, Widget? child, {BorderRadius? borderRadius, bool shouldBounceOnTap = true, Color backgroundColor = Colors.black, bool showDebugPrints = false})
→ Widget
-
Hook for
MaterialApp.builder / WidgetsApp.builder.
-
dismissAll({VoidCallback? onDismissed})
→ void
-
Dismisses all active modals of all types immediately
-
dismissAllSnackbars()
→ void
-
Dismisses all snackbars while preserving other active modals
-
dismissBottomSheet({String? id, VoidCallback? onDismissed})
→ Future<void>
-
Dismisses only the bottom sheet, preserving snackbars and dialogs
-
dismissById(String id, {VoidCallback? onDismissed})
→ Future<bool>
-
Dismisses a specific modal by its ID (PRIMARY DISMISSAL METHOD)
-
dismissByType(ModalType type)
→ Future<void>
-
Dismisses modals by type
-
dismissDialog({String? id, VoidCallback? onDismissed})
→ Future<void>
-
Dismisses only the dialog by its ID
-
dismissSideSheet({String? id, VoidCallback? onDismissed})
→ Future<void>
-
Dismisses the active side sheet (if any)
-
dismissSnackbarAtPosition(Alignment position)
→ void
-
Dismisses snackbars at a specific position
-
dismissTopSheet({String? id, VoidCallback? onDismissed})
→ Future<void>
-
Dismisses the currently active top sheet
-
disposeActivator()
→ void
-
Cleans up resources used by the modal system
-
getActiveIdsByType(ModalType type)
→ List<String>
-
Gets all active modal IDs of a specific type
-
getModalTypeById(String id)
→ ModalType?
-
Gets the type of an active modal by its ID
-
isModalActiveById(String id)
→ bool
-
Checks if a modal with the given ID exists and is active
-
registerHeightResetCallback(VoidCallback callback)
→ void
-
Registers a callback function to reset modal height measurements
-
show({BuildContext? context, required ModalWidgetBuilder builder, String? id, ModalType modalType = ModalType.sheet, Alignment modalPosition = Alignment.bottomCenter, ModalAnimationType modalAnimationType = ModalAnimationType.fade, bool shouldBlurBackground = false, double blurAmount = 3.0, bool isDismissable = true, bool blockBackgroundInteraction = false, bool isDraggable = false, bool isExpandable = false, double? size, double expandedPercentageSize = 85, double contentPaddingByDragHandle = 35.0, bool isSwipeable = true, Duration? autoDismissDuration, SnackbarDisplayMode snackbarDisplayMode = SnackbarDisplayMode.staggered, int maxStackedSnackbars = 3, Color? backgroundColor, double? snackbarWidth, Color barrierColor = Colors.transparent, Offset? offset, SheetPosition? sheetPosition, Function? onDismissed, VoidCallback? onExpanded, VoidCallback? onTap})
→ void
-
Displays a modal on screen
-
showSnackbar({BuildContext? context, String? text, IconData? prefixIcon, bool showSuffixIcon = true, Color? backgroundColor, Color textColor = Colors.white, Color iconColor = Colors.white, ModalWidgetBuilder? builder, Alignment position = Alignment.topCenter, Duration? duration = const Duration(seconds: 4), bool isDismissible = true, Color barrierColor = Colors.transparent, SnackbarDisplayMode displayMode = SnackbarDisplayMode.replace, String? id, double? width, Offset? offset, int maxStackedSnackbars = 3, Function? onDismissed, VoidCallback? onTap, bool showDurationTimer = true, Color? durationTimerColor, DurationIndicatorDirection durationTimerDirection = DurationIndicatorDirection.leftToRight, bool handleDurationTimerManually = false})
→ void
-
Shows a snackbar with support for multiple stacked snackbars
-
updateParams({required String id, ModalWidgetBuilder? builder, String? builderId, double? blurAmount, bool? shouldBlurBackground, bool? isExpandable, double? size, bool resetSize = false, double? expandedPercentageSize, double? contentPaddingByDragHandle, SheetPosition? sheetPosition, bool? isDismissable, bool? blockBackgroundInteraction, bool? isDraggable, Function? onDismissed, Function? onExpanded, ModalType? modalType, Alignment? modalPosition, ModalAnimationType? modalAnimationType, bool? isSwipeable, Duration? autoDismissDuration, SnackbarDisplayMode? snackbarDisplayMode, int? maxStackedSnackbars, Color? backgroundColor, bool resetBackgroundColor = false, double? snackbarWidth, Color? barrierColor, Offset? offset = _noOffsetChange})
→ void
-
Updates specific parameters of an active modal without recreating the entire ModalContent