PrimitiveGradient class

The most basic representation of a gradient.

Annotations

Constructors

PrimitiveGradient.byCombination(Gradient a, Gradient b, double t)
Vanilla Flutter gradient merge process.
factory
PrimitiveGradient.byProgressiveMerge(PrimitiveGradient a, PrimitiveGradient b, double t)
This factory constructor will return a PrimitiveGradient whose colors and stops are progressively merged (as t progresses from 0.0 -> 1.0) by lerping any entries that fall within a shared common list length range and adding any potential extra entries sourced from b as t grows while removing any potential extra entries sourced from a as t grows.
factory
PrimitiveGradient.from(Gradient gradient)
Dissolve a Gradient into a PrimitiveGradient.
factory
PrimitiveGradient.fromStretchLerp(dynamic a, dynamic b, double t)
Interpolate two Gradients' or PrimitiveGradients' colors and stops at t.
factory

Properties

colors → List<Color>
The interpolated colors of the true Gradients that this PrimitiveGradient boils down.
final
hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
stops → List<double>
The interpolated stops of the true Gradients that this PrimitiveGradient boils down.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
scale(double factor) → PrimitiveGradient
"Scaling" this gradient represents reducing the opacity of all its colors by Color.lerp with null using factor as the keyframe t.
stretchedTo(int length) → PrimitiveGradient
Force this PrimitiveGradient to have length number of colors/stops.
toString() → String
A string representation of this object.
inherited

Operators

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

Static Methods

extrapolateStop(List<double> stops, double t) → double
Extrapolate the stop at position t from a configured list of stops.
sameLengthLerp(PrimitiveGradient a, PrimitiveGradient b, double t) → PrimitiveGradient
Linearally interpolate between PrimitiveGradients a and b at any given keyframe (double) t, generally 0.0 .. 1.0.
sample(List<Color> colors, List<double> stops, double t) → Color
Calculate the color at position t of the gradient defined by colors and stops.
Modified from vanilla Gradient _sample() to support fewer Colors.