Defines the snapping behavior for a sheet during scrolling and dragging.
The snapping behavior determines how the sheet transitions between different states based on user interactions and animations. It provides snapping offsets, state calculations, and interpolation between states.
See also:
- ComponentsSnappingBehavior: A snapping behavior based on the size of sheet components.
- FractionSnappingBehavior: A snapping behavior based on fractions of the viewport height.
- SizeSnappingBehavior: A snapping behavior based on sheet sizes in pixels.
- MultiSnappingBehavior: A snapping behavior that combines multiple snapping models.
- SnappingModel: The base class for defining snapping models used by snapping behaviors.
Constructors
- SnappingBehavior({bool clipByHeader = true})
- Base constructor for a SnappingBehavior class.
Properties
- avaliableSpace ↔ double
-
Gets the available height for the sheet in pixels.
getter/setter pair
-
cachedClosestOffsets
→ FrameStackHashMap<
double, (double, double)> -
Caches the closest offsets to optimize repeated calculations for a single frame.
final
-
cachedState
→ FrameStackHashMap<
double, int> -
Caches the state associated with a specific offset for optimized state retrieval.
final
-
cachedStateFromOffset
→ HashMap<
double, int> -
Caches the mapping of offsets to their corresponding states.
final
- clipByHeader → bool
-
Determines whether the header should clip max offset of the sheet.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasSizes → bool
-
Indicates if the sheet has been initialized with valid sizes.
no setter
- headerShiftHeight ↔ double
-
The height of the header that is used to shift the max offset.
getter/setter pair
- isMaxOffsetFinalized → bool
-
Checks if the maximum offset has been finalized.
no setter
- lastMaxOffset ↔ double
-
Gets the last maximum height offset of the sheet and padding from the top boundary.
getter/setter pair
- maxOffset ↔ double
-
The maximum height offset of the sheet and padding from the top boundary.
getter/setter pair
- minOffset ↔ double
-
The minimum height offset of the sheet from the top boundary.
getter/setter pair
- needsSetup → bool
-
Indicates if the snapping behavior requires setup or reinitialization.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- safeMaxOffset → double
-
no setter
- shouldSnap → bool
-
Determines if the sheet should snap to the snapping positions.
no setter
-
snappingOffsets
↔ SplayTreeSet<
double> ? -
Stores the snapping offsets of the sheet in pixels.
getter/setter pair
-
snappingPixelOffsets
→ List<
double> -
Gets the snapping offsets as a list of pixel values.
no setter
-
snappingPixelOffsetsClamped
→ List<
double> -
no setter
Methods
-
anchoredState<
T> (MultiStateSheetExtent< T> extent) → int - Determines the anchored state for the current extent offset.
-
getClosestOffsets<
StateType> (double offset, MultiStateSheetExtent< StateType> extent) → (double, double) - Finds the two closest snapping offsets to the given offset.
-
getFirstOffsetAfter<
T> (double offset) → double - Finds the first snapping offset greater than or equal to the given offset.
-
getInterpolation<
T> ({required MultiStateSheetExtent< T> extent, required double offset}) → double - Calculates the interpolation value between two snapping states.
-
getLastOffsetBefore<
T> (double offset) → double - Finds the last snapping offset less than or equal to the given offset.
-
getState<
T> ({required MultiStateSheetExtent< T> extent, required double offset}) → int - Gets the state associated with the specified offset.
-
getStateFromOffset<
T> (double offset, MultiStateSheetExtent< T> extent) → int - Maps the given offset to its corresponding state index.
-
isAtSnapOffset<
T> ({required MultiStateSheetExtent< T> extent, required double toleranceDistance}) → bool - Checks if the current offset is at a snapping position.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
offsetFromState(
int state) → double - Gets the snapping offset for the specified state.
-
performSetup<
T> (MultiStateSheetExtent< T> extent) → SplayTreeSet<double> ? - Sets up the snapping behavior for the sheet.
-
reset(
) → void - Resets the cached values and state of the snapping behavior.
-
setup<
T> (MultiStateSheetExtent< T> extent) → void - Configures the snapping behavior using the provided extent.
-
stateOfOffset(
double offset) → int - Gets the state index for a given offset.
-
statePosition<
T> ({required MultiStateSheetExtent< T> extent, required int state}) → double - Gets the clamped position of the sheet for a given state.
-
stateToIndex(
int state) → int - Converts a state index to an offset index.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited