Spring class final

Flutter's SpringDescription: either the physical triple (SpringDescription(mass:, stiffness:, damping:), when stiffness and damping are both given) or SpringDescription.withDurationAndBounce (duration ms, bounce). The one spring value of the model: transitions, animations, gestures, a flip card's settle and a route's dismiss all take it. JSON: {"stiffness": 380, "damping": 36} or {"duration": 500, "bounce": 0.3} (sparse; {} is withDurationAndBounce()'s defaults).

Annotations

Constructors

Spring({double? stiffness, double? damping, double mass = 1, int duration = 500, double bounce = 0})
const
Spring.physical({required double stiffness, required double damping, double mass = 1})
SpringDescription(mass:, stiffness:, damping:).
const

Properties

bounce → double
final
damping → double?
The physical spring's constants; both null: duration and bounce.
final
duration → int
withDurationAndBounce(duration:, bounce:): the perceptual settle time (ms) and the bounce (0 none, up to 1 wobbly; negative sluggish).
final
effectiveDamping → double
The damping coefficient in effect.
no setter
effectiveStiffness → double
The stiffness in effect (withDurationAndBounce's formula when not isPhysical).
no setter
hashCode → int
The hash code for this object.
no setterinherited
isPhysical → bool
Given as the physical triple.
no setter
mass → double
final
props → List<Object?>
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
stiffness → double?
The physical spring's constants; both null: duration and bounce.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() → Json
toJsonOver(Spring base) → Json
toJson without what base (the owner's default) already says: a physical spring over a physical default writes only the constants that differ ({"stiffness": 200}), as fromJson reads them back.
toString() → String
A string representation of this object.
inherited

Operators

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

Static Methods

fromJson(Object? json, {Spring? fallback}) → Spring?
json as a spring; a physical spring missing one constant takes fallback's. Null when json isn't an object.