Modals topic

Alerts, sheets, menus and popovers on glass. They are built in the navigator's overlay, so the GlassHost has to be above the navigator (MaterialApp.builder) for them to see the screen they open over.

API What it is
showGlassDialog, GlassAlert, GlassAlertAction An alert that materializes over the screen: blur first, tint last.
showGlassSheet A sheet from the bottom edge, dragged down to close (unless it is not barrier-dismissible).
GlassMenuAnchor, GlassMenuItem, GlassMenuController A menu that grows out of the button that opened it.
GlassPopoverAnchor A panel of any content that grows out of its anchor.

An alert

showGlassDialog<void>(
  context: context,
  builder: (BuildContext context) => GlassAlert(
    title: const Text('Delete all notes?'),
    message: const Text('This cannot be undone.'),
    actions: <GlassAlertAction>[
      GlassAlertAction(label: 'Cancel', isDefault: true, onPressed: () => Navigator.pop(context)),
      GlassAlertAction(label: 'Delete', isDestructive: true, onPressed: () => Navigator.pop(context)),
    ],
  ),
);

A sheet only its own buttons close

showGlassSheet<void>(
  context: context,
  barrierDismissible: false, // not the dim, not Escape, not a drag
  showGrabber: false,
  builder: (BuildContext context) => const SignInForm(),
);

A menu

GlassMenuAnchor(
  items: <GlassMenuItem>[
    GlassMenuItem(label: 'Rename', onPressed: rename),
    GlassMenuItem(label: 'Delete', isDestructive: true, onPressed: delete),
  ],
  builder: (BuildContext context, GlassMenuController menu) =>
      GlassButton(onPressed: menu.open, child: const Icon(Icons.more_horiz)),
)

Classes

GlassAlert Modals
iOS 26's alert, on glass.
GlassAlertAction Modals
One button of a GlassAlert.
GlassMenuAnchor Modals
A glass menu that grows out of builder's anchor, in the nearest Overlay, which has to be under the GlassHost.
GlassMenuController Modals
What a GlassMenuAnchor's or a GlassPopoverAnchor's builder is given to open and close what it anchors.
GlassMenuItem Modals
One row of a GlassMenuAnchor's menu, kGlassMenuRowHeight tall.
GlassPopoverAnchor 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.

Constants

kGlassAlertRadius → const double Modals
The alert's corner radius, logical px (spike 33: layer.cornerRadius, a continuous corner).
kGlassAlertWidth → const double Modals
The alert's width, logical px (spike 33).
kGlassMenuRadius → const double Modals
A menu's corner radius, logical px (spike 34: the engine's RSuperellipse of 31.5, fitted at 0.23 pt rms). The default of GlassPopoverAnchor.radius.
kGlassMenuRowHeight → const double Modals
The height of one GlassMenuItem, logical px (spike 34: rows of 42, with 10 above the first and below the last).
kGlassMenuWidth → const double Modals
A menu's width, logical px (spike 34: iOS 26.5's UIMenu from a button, 250 wide). The default of GlassMenuAnchor.width.
kGlassModalDim → const Color Modals
The dim behind an alert and a sheet (spike 33): black at 0.20, read off iOS 26.5 over a grid of two known levels.
kGlassSheetInset → const double Modals
How far the sheet stands in from the window's sides and bottom, and below the top safe area, logical px (spike 33, the medium detent).
kGlassSheetRadius → const double Modals
The sheet's corner radius, logical px (spike 33: the engine's RSuperellipse of 36, fitted at 0.54 device px rms).

Functions

showGlassDialog<T>({required BuildContext context, required WidgetBuilder builder, bool barrierDismissible = false, String barrierLabel = 'Dismiss', Duration transitionDuration = const Duration(milliseconds: 250)}) → Future<T?> Modals
Shows builder's widget — a GlassAlert, typically — over a dim, centred, in the navigator's overlay.
showGlassSheet<T>({required BuildContext context, required WidgetBuilder builder, GlassFinish? finish, bool showGrabber = true, bool barrierDismissible = true, String barrierLabel = 'Dismiss', BoxConstraints? constraints}) → Future<T?> Modals
Shows builder's widget in a glass sheet rising from the bottom, over a dim. Dragged down, it follows the finger and goes past a third of its height or on a flick.