orderedStates property
List<GlassSheetState>
get
orderedStates
The rest states this sheet can occupy, ordered low → high. This is the single source of truth for the state machine — snapping, min/max bounds, and resistance all derive from it, so a sheet can omit any of peek / half / full and the machine simply routes around the missing detent.
Implementation
List<GlassSheetState> get orderedStates {
final states = <GlassSheetState>[];
// Hidden is a drag target (swipe-to-dismiss) only when the sheet is
// dismissible, has no peek floor, and isn't a persistent sheet. A
// non-dismissible sheet rubber-bands at its lowest detent instead (the
// Apple Pay / Sign in with Apple pattern — no accidental swipe-away).
if (dismissible && !enablePeek && mode == GlassSheetMode.dismissible) {
states.add(GlassSheetState.hidden);
}
if (enablePeek) states.add(GlassSheetState.peek);
if (enableHalf && halfSize > 0) states.add(GlassSheetState.half);
if (enableFull) states.add(GlassSheetState.full);
// Guardrail for the invalid all-disabled config (asserted against in the
// widget in debug): a sheet must have at least one primary detent, so fall
// back to half in release rather than render an un-openable sheet.
if (!states.contains(GlassSheetState.half) &&
!states.contains(GlassSheetState.full)) {
states.add(GlassSheetState.half);
}
return states;
}