SheetGeometry class
Pure geometry calculations for sheet snap positions — no BuildContext, no side effects.
Encapsulates which detents are active, their physical positions, and the logic for resolving snap targets and rubber-band resistance. Fully testable without a widget tree.
Constructors
- SheetGeometry({required GlassSheetMode mode, required double halfSize, double? fullSize, required double peekSize, bool enablePeek = true, bool enableHalf = true, bool enableFull = true, bool dismissible = true})
-
Creates a sheet geometry configuration.
const
Properties
- dismissible → bool
-
Whether the sheet can be dragged below its lowest detent to dismiss.
final
- enableFull → bool
-
Whether the full-screen detent is active.
final
- enableHalf → bool
-
Whether the half-height detent is active.
final
- enablePeek → bool
-
Whether the peek floor detent is active.
final
- fullSize → double?
-
Optional explicit height for the GlassSheetState.full detent.
When null, defaults to
screenHeight - 90.0.final - halfSize → double
-
Height of the GlassSheetState.half detent in logical pixels (> 1.0)
or as a screen-height fraction (≤ 1.0).
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- maxState → GlassSheetState
-
The highest detent in the active configuration.
no setter
- minState → GlassSheetState
-
The lowest detent in the active configuration.
no setter
- mode → GlassSheetMode
-
The dismissal mode (dismissible vs persistent floor).
final
-
orderedStates
→ List<
GlassSheetState> -
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.
no setter
- peekSize → double
-
Height of the GlassSheetState.peek floor detent.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
applyResistance(
double rawPosition, double screenHeight, {required double resistance}) → double - Applies rubber-band resistance when dragging beyond bounds.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
positionForState(
GlassSheetState state, double screenHeight) → double -
Like positionFor but applies cascade constraints so snap positions are
always ordered:
hidden ≤ peek ≤ half ≤ full. -
resolveTarget(
SheetSnapshot current, {required double snapThreshold, required double velocityThreshold}) → GlassSheetState - Computes target state based on current position and velocity.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
positionFor(
GlassSheetState state, double screenHeight, {GlassSheetMode? mode, double? halfSize, double? fullSize, double? peekSize}) → double -
Returns the normalized position (0.0–1.0) for
stategivenscreenHeight. -
resolvePeek(
{required bool? enablePeek, required Set< GlassSheetDetent> detents, required GlassSheetMode mode}) → bool - Resolve whether the peek floor is active, from the public API's three inputs. Pure and static so the precedence is testable and reviewable in one place instead of inline in the widget's state.