MenuAnchor class
Shows menuChildren on the package-owned root overlay, anchored to the launcher.
Placement uses integer terminal cells and follows the current-frame launcher geometry. Resize or ancestor movement repositions an open menu in that same frame; unlike Flutter, Noir does not close on view resize or anchor movement. MenuController.open's optional Offset is launcher-local and ignores alignmentOffset.
Outside pointer events are consumed at render-tree priority so they cannot reach lower targets. Only a left-button down closes the topmost menu; other outside pointer kinds are consumed without closing. TuiApp.onMouse remains app-priority and may still observe the raw event.
Escape, Tab, and Shift+Tab close the open menu, consume the key, and restore focus. Tab does not advance on that dismissal event. Independent anchors do not form a group. Caller-supplied controller replacement preserves the current open subtree without firing onOpen or onClose; teardown also skips those callbacks.
- Inheritance
-
- Object
- Widget
- StatefulWidget
- MenuAnchor
Constructors
- MenuAnchor({Key? key, MenuController? controller, FocusNode? childFocusNode, Offset? alignmentOffset = Offset.zero, EdgeInsets? reservedPadding, VoidCallback? onOpen, VoidCallback? onClose, MenuAnchorChildBuilder? builder, Widget? child})
-
Anchors
menuChildrentobuilderorchildon the root overlay.const
Properties
- alignmentOffset → Offset?
-
Extra offset from the launcher's bottom-start. Null is Offset.zero.
final
- builder → MenuAnchorChildBuilder?
-
Builds the launcher from the active controller.
final
- child → Widget?
-
Launcher widget when builder is omitted.
final
- childFocusNode → FocusNode?
-
Focus node restored when the menu closes, when supplied.
final
- controller → MenuController?
-
Caller-owned controller, or null to use an internal one.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how this widget replaces another of the same type.
finalinherited
-
Unstyled vertical children of the open menu.
final
- onClose → VoidCallback?
-
Invoked once on each open-to-close transition, except teardown.
final
- onOpen → VoidCallback?
-
Invoked once on each closed-to-open transition.
final
- reservedPadding → EdgeInsets?
-
Safe-area padding inside the terminal. Null is EdgeInsets.zero.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
createState(
) → State< MenuAnchor> -
Creates the mutable State for this widget.
override
-
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