GlassAlert class Modals
iOS 26's alert, on glass.
kGlassAlertWidth wide and kGlassAlertRadius round, its title bold above a dimmer message and its actions below as capsules: two side by side, any other number stacked. It materializes with the route that shows it — blur first, tint last, the content fading in on top — and is lifted kGlassModalLift levels (GlassAbove), so glass bars under it show in its backdrop. Shown with showGlassDialog.
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.
showGlassDialog<void>(
context: context,
builder: (BuildContext context) => GlassAlert(
title: const Text('Turn on notifications?'),
message: const Text('You can change this later in Settings.'),
actions: <GlassAlertAction>[
GlassAlertAction(label: 'Not now', onPressed: () => Navigator.pop(context)),
GlassAlertAction(label: 'Allow', isDefault: true, onPressed: () => Navigator.pop(context)),
],
),
);
See also:
- showGlassDialog, which puts it on screen.
- GlassAlertAction, one of its buttons.
- The alert on the site.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- GlassAlert
Constructors
-
GlassAlert({required Widget title, Widget? message, List<
GlassAlertAction> actions = const <GlassAlertAction>[], GlassFinish? finish, Key? key}) -
An alert headed by
title.const
Properties
-
actions
→ List<
GlassAlertAction> -
The buttons, in order: two share a row, any other number stack. Empty
leaves the alert without buttons, to be closed some other way.
final
- finish → GlassFinish?
-
The 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
- message → Widget?
-
The text under title, at 15 pt in the label colour at 60%. Null leaves
it out.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- title → Widget
-
The heading, at 17 pt semibold in the label colour the theme chose for
the glass. Usually a Text.
final
Methods
-
build(
BuildContext context) → Widget -
Describes the part of the user interface represented by this widget.
override
-
createElement(
) → StatelessElement -
Creates a StatelessElement to manage this widget's location in the tree.
inherited
-
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