GlassBarItem.sheet constructor
- required Widget icon,
- required void onPresent(
- GlassMorphAnchor? anchor
- Object? id,
- String? label,
- bool enabled,
- GlassBarItemBackground background,
- Color? tintColor,
- GlassBarItemAxisBehavior axisBehavior,
An icon whose tap presents a GlassModalSheet that morphs out of the
capsule, mirroring the iOS 26 bar button that grows into a sheet.
onPresent is handed the GlassMorphAnchor of the capsule this item
sits in; pass it to GlassModalSheet.show(morphFrom:) and the capsule
empties, stretches into the sheet, and is poured back on dismissal. It is
the capsule rather than the icon's own slot for the reason
GlassBarItem.menu morphs the whole capsule: on screen the cluster is one
control, and a droplet crawling out of a hole in it reads as a second
object arriving.
The anchor is the capsule actually on screen: the route's own where the
bar draws in-route, and the hoisted copy under a GlassNavigationShell.
A presentation hands the chrome back to its route, but the shell keeps
this capsule through the sheet — the morph has emptied it, so nothing of
it is drawn above the sheet, and the droplet has somewhere to come home
to. It is the group's own box where the group draws no glass
(GlassBarItemBackground.none and GlassBarItemBackground.own).
onPresent may take its time — measure the sheet's content, await a
fetch: the shell keeps the capsule on the strength of the tap until a
route is presented over this one, and lets go only if that presentation
arrives without the morph.
Dismiss the sheet before navigating, as an open GlassMenu is dismissed for you.
Implementation
const factory GlassBarItem.sheet({
required Widget icon,
required void Function(GlassMorphAnchor? anchor) onPresent,
Object? id,
String? label,
bool enabled,
GlassBarItemBackground background,
Color? tintColor,
GlassBarItemAxisBehavior axisBehavior,
}) = GlassBarSheetItem;