Modal class
Constructors
- Modal()
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
dismissByIds(
List< String> ids, {VoidCallback? onDismissed}) → Future<List< String> > - Dismisses multiple modals by their IDs
-
dismissCurrentModal(
{VoidCallback? onModalDismissed}) → Future< void> - Dismisses the currently active modal
-
dismissSnackbar(
String id, {VoidCallback? onDismissed}) → Future< bool> - Dismisses a specific snackbar by its ID
-
durationIndicator(
{required Duration duration, double height = 3.0, Color? color, Color? backgroundColor, BorderRadius? borderRadius, DurationIndicatorDirection direction = DurationIndicatorDirection.leftToRight}) → Widget - Creates a duration indicator widget for use in custom snackbar builders
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- activeDialogId → String?
-
Gets the ID of the currently active dialog (if any)
no setter
- activeModalId → String?
-
Returns the unique ID of the currently active modal
no setter
-
activeModalRegistry
→ Map<
String, ModalType> -
Gets the registry of all active modals
no setter
- activeSheetId → String?
-
Gets the ID of the currently active sheet (if any)
no setter
-
activeSnackbarIds
→ List<
String> -
Gets all IDs of active snackbars
no setter
-
allActiveModalIds
→ List<
String> -
Gets all currently active modal IDs
no setter
- bottomSheetTemplate → Widget
-
Returns a default modal configuration
no setter
-
controller
→ Injected<
_ModalContent?> -
Access to the active modal controller
no setter
-
dialogController
→ Injected<
_ModalContent?> -
Controller for dialog modals
no setter
-
dismissModalAnimationController
→ Injected<
bool> -
Controller that tracks the modal dismissal animation state
no setter
- isActive → bool
-
Indicates whether any modal is currently being shown
no setter
- isAppBuilderInstalled → bool
-
Whether Modal.appBuilder has already been installed in the widget tree.
no setter
- isBottomSheetActive → bool
-
Returns true if a bottom sheet is currently active
Bottom sheets use the sheet controller with bottom position
no setter
- isBottomSheetDismissing → bool
-
Returns true if a bottom sheet dismissal is in progress
Bottom sheets use the sheet dismissing notifier
no setter
- isDialogActive → bool
-
Returns true if a dialog is currently active
no setter
- isDialogDismissing → bool
-
Returns true if a dialog dismissal is in progress
no setter
- isDismissing ↔ bool
-
Flag to track if a dismissal operation is in progress
Prevents multiple simultaneous dismissals
getter/setter pair
- isSheetActive → bool
-
Returns true if a bottom sheet is currently active
no setter
- isSheetDismissing → bool
-
Returns true if a sheet dismissal is in progress
no setter
- isSideSheetActive → bool
-
Returns true if a side sheet is currently active
Side sheets use the sheet controller with left/right positions
no setter
- isSideSheetDismissing → bool
-
Returns true if a side sheet dismissal is in progress
Side sheets use the sheet dismissing notifier
no setter
- isSnackbarActive → bool
-
Returns true if any snackbars are currently active
no setter
- isSnackbarDismissing → bool
-
Returns true if snackbar dismissal is in progress
no setter
- isTopSheetActive → bool
-
Returns true if a top sheet is currently active
Top sheets use the sheet controller with top position
no setter
- isTopSheetDismissing → bool
-
Returns true if a top sheet dismissal is in progress
Top sheets use the sheet dismissing notifier
no setter
-
sheetController
→ Injected<
_ModalContent?> -
Controller for sheet modals (bottom, top, and side sheets)
no setter
-
sideSheetController
→ Injected<
_ModalContent?> -
Access to the side sheet controller
no setter
-
snackbarController
→ Injected<
_ModalContent?> -
Controller for snackbar modals
no setter
-
snackbarQueue
→ Injected<
Map< Alignment, List< >_ModalContent> > -
Access to the snackbar queue
no setter
-
snackbarStackIndex
→ Injected<
int> -
Access to the current snackbar stack index
no setter
- snackStaggeredViewDismissBarrierColor ↔ Color
-
Background barrier color for the expanded staggered snackbar view
getter/setter pair
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 showCloseIcon = 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