GlassPopoverAnchor class Modals
A glass panel of any content that grows out of builder's anchor, as GlassMenuAnchor's menu does, and stays open until a tap outside it or GlassMenuController.close — a popover, for content that is changed in place rather than chosen once.
Its height is not known before it is laid out, so the side it opens to is the anchor's half of the screen: down from an anchor in the upper half, up from one in the lower.
Note: The GlassHost has to be above the navigator. A glass surface is captured by the host above it, and a modal is built in the
Overlayit is shown in — for a dialog or a sheet the navigator's, for a menu or a popover the nearest one. In aWidgetsAppor aMaterialAppthat meansbuilder: (context, child) => GlassHost(child: child!). Built anywhere else the modal finds no host, and says so in debug rather than drawing glass that samples nothing.
GlassPopoverAnchor(
width: 280,
popoverBuilder: (BuildContext context) => Padding(
padding: const EdgeInsets.all(16),
child: GlassSlider(value: volume, onChanged: setVolume),
),
builder: (BuildContext context, GlassMenuController popover) =>
GlassButton(onPressed: popover.open, child: const Icon(Icons.volume_up)),
)
See also:
- GlassMenuAnchor, the same placement for a list of choices.
- GlassMenuController, to open and close it from outside builder.
- The popover on the site.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- GlassPopoverAnchor
Constructors
- GlassPopoverAnchor({required WidgetBuilder popoverBuilder, required Widget builder(BuildContext context, GlassMenuController controller), GlassMenuController? controller, GlassFinish? finish, double width = 320, double radius = kGlassMenuRadius, String barrierLabel = 'Dismiss', Key? key})
-
A panel of
popoverBuilder's content over the anchorbuilderreturns.const
Properties
- barrierLabel → String
-
See GlassMenuAnchor.barrierLabel.
final
- builder → Widget Function(BuildContext context, GlassMenuController controller)
-
Builds the anchor — usually a button whose
onPressedcalls GlassMenuController.open. Hidden while the panel stands over it.final - controller → GlassMenuController?
-
Opens and closes the panel from elsewhere. Null makes one, handed to
builder either way.
final
- finish → GlassFinish?
-
The panel's optics. Null takes the theme's.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- popoverBuilder → WidgetBuilder
-
The panel's content. Built under a text style and icon theme in the
label colour the theme chose for finish.
final
- radius → double
-
The panel's corner radius once open, logical px; kGlassMenuRadius by
default. It grows to this from the anchor's capsule.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- width → double
-
The panel's width, logical px. Its height is its content's.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< GlassPopoverAnchor> -
Creates the mutable state for this widget at a given location in the tree.
override
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited