FractionSnappingBehavior<StateType> class final

Controls the snapping behavior of a sheet based on fractions of its bounding box.

This behavior defines snapping positions for the sheet by calculating offsets relative to specified fractions of the viewport. It ensures smooth transitions between states and provides boundaries for the minimum and maximum offsets.

Inheritance

Constructors

FractionSnappingBehavior({required Set<double> fractions, bool clipByHeader = true})
Constructs an FractionSnappingBehavior with the specified fractions.

Properties

avaliableSpace double
Gets the available height for the sheet in pixels.
getter/setter pairinherited
cachedClosestOffsets FrameStackHashMap<double, (double, double)>
Caches the closest offsets to optimize repeated calculations for a single frame.
finalinherited
cachedState FrameStackHashMap<double, int>
Caches the state associated with a specific offset for optimized state retrieval.
finalinherited
cachedStateFromOffset HashMap<double, int>
Caches the mapping of offsets to their corresponding states.
finalinherited
clipByHeader bool
Determines whether the header should clip max offset of the sheet.
finalinherited
fractions Set<double>
The set of fractions used to determine snapping positions.
final
hashCode int
The hash code for this object.
no setterinherited
hasSizes bool
Indicates if the sheet has been initialized with valid sizes.
no setterinherited
headerShiftHeight double
The height of the header that is used to shift the max offset.
getter/setter pairinherited
isMaxOffsetFinalized bool
Checks if the maximum offset has been finalized.
no setterinherited
lastMaxOffset double
Gets the last maximum height offset of the sheet and padding from the top boundary.
getter/setter pairinherited
maxOffset double
The maximum height offset of the sheet and padding from the top boundary.
getter/setter pairinherited
minOffset double
The minimum height offset of the sheet from the top boundary.
getter/setter pairinherited
model FractionSnappingModel
The snapping model used to calculate offsets based on fractions.
final
needsSetup bool
Indicates if the snapping behavior requires setup or reinitialization.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
safeMaxOffset double
no setterinherited
shouldSnap bool
Determines if the sheet should snap to the snapping positions.
no setterinherited
snappingOffsets SplayTreeSet<double>?
Stores the snapping offsets of the sheet in pixels.
getter/setter pairinherited
snappingPixelOffsets List<double>
Gets the snapping offsets as a list of pixel values.
no setterinherited
snappingPixelOffsetsClamped List<double>
no setterinherited

Methods

anchoredState<T>(MultiStateSheetExtent<T> extent) int
Determines the anchored state for the current extent offset.
inherited
getClosestOffsets<StateType>(double offset, MultiStateSheetExtent<StateType> extent) → (double, double)
Finds the two closest snapping offsets to the given offset.
inherited
getFirstOffsetAfter<T>(double offset) double
Finds the first snapping offset greater than or equal to the given offset.
inherited
getInterpolation<T>({required MultiStateSheetExtent<T> extent, required double offset}) double
Calculates the interpolation value between two snapping states.
inherited
getLastOffsetBefore<T>(double offset) double
Finds the last snapping offset less than or equal to the given offset.
inherited
getState<T>({required MultiStateSheetExtent<T> extent, required double offset}) int
Gets the state associated with the specified offset.
inherited
getStateFromOffset<T>(double offset, MultiStateSheetExtent<T> extent) int
Maps the given offset to its corresponding state index.
inherited
isAtSnapOffset<T>({required MultiStateSheetExtent<T> extent, required double toleranceDistance}) bool
Checks if the current offset is at a snapping position.
inherited
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.
inherited
performSetup<T>(MultiStateSheetExtent<T> extent) SplayTreeSet<double>?
Sets up the snapping behavior for the sheet.
override
reset() → void
Resets the cached values and state of the snapping behavior.
inherited
setup<T>(MultiStateSheetExtent<T> extent) → void
Configures the snapping behavior using the provided extent.
inherited
stateOfOffset(double offset) int
Gets the state index for a given offset.
inherited
statePosition<T>({required MultiStateSheetExtent<T> extent, required int state}) double
Gets the clamped position of the sheet for a given state.
inherited
stateToIndex(int state) int
Converts a state index to an offset index.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited