GradientUtils extension Null safety

Offers copyWith method to make duplicate Gradients as well as global getters for any Gradient with specific fallbacks; reversed to easily return a Gradient with its colors reversed; and animate, as a shortcut to provide this Gradient as an AnimatedGradient's source and return the AnimatedGradient.observe output.

on

Properties

begin AlignmentGeometry
If this is a linear-type Gradient, returns this.begin. Otherwise the fallback retrun value is Alignment.center.
read-only
center AlignmentGeometry
If this is a radial- or sweep-type Gradient, returns this.center. Otherwise the fallback retrun value is Alignment.center.
read-only
distance double
If this is a ShadedSteps-type Gradient, returns this.distance. Otherwise the fallback retrun value is 0.0.
read-only
end AlignmentGeometry
If this is a linear-type Gradient, returns this.end. Otherwise the fallback retrun value is Alignment.center.
read-only
endAngle double
If this is a sweep-type Gradient, returns this.endAngle. Otherwise the fallback retrun value is 0.0.
read-only
focal AlignmentGeometry?
If this is a radial-type Gradient, returns this.focal which may be null. Otherwise the fallback retrun value is null.
read-only
focalRadius double
If this is a radial-type Gradient, returns this.focalRadius. Otherwise the fallback retrun value is 0.0.
read-only
radius double
If this is a radial-type Gradient, returns this.radius. Otherwise the fallback retrun value is 0.0.
read-only
reversed Gradient
Returns a copy of this Gradient with its List<Color> colors reversed as well as any potential stops.
read-only
shadeFactor double
If this is a ShadedSteps-type Gradient, returns this.shadeFactor. Otherwise the fallback retrun value is 0.
read-only
shadeFunction ColorArithmetic
If this is a ShadedSteps-type Gradient, returns this.shadeFunction. Otherwise the fallback retrun value is Shades.withWhite.
read-only
softness double
If this is a Steps-type Gradient, returns this.softness. Otherwise the fallback retrun value is 0.0.
read-only
startAngle double
If this is a sweep-type Gradient, returns this.startAngle. Otherwise the fallback retrun value is 0.0.
read-only
steppedColors List<Color>
If this is a Steps-type Gradient, returns this.steppedColors. Otherwise the fallback retrun value is colors.
read-only
steppedStops List<double>?
If this is a Steps-type Gradient, returns this.steppedStops. Otherwise the fallback retrun value is stops.
read-only
tileMode TileMode
How this Gradient tiles in the plane beyond the region before its starting stop and after its ending stop. [...]
read-only

Methods

animate({required Animation<double> controller, Map<GradientAnimation, dynamic> storyboard = const {}, GradientCopyWith overrideCopyWith = spectrumCopyWith}) Gradient
Returns the AnimatedGradient.observe animated Gradient output from a new AnimatedGradient constructed by this gradient and the provided parameters. [...]
copyWith({List<Color>? colors, List<double>? stops, GradientTransform? transform, TileMode? tileMode, AlignmentGeometry? begin, AlignmentGeometry? end, AlignmentGeometry? center, double? radius, AlignmentGeometry? focal, double? focalRadius, double? startAngle, double? endAngle, double? softness, ColorArithmetic? shadeFunction, double? shadeFactor, double? distance}) Gradient
📋 Returns a new copy of this Gradient with any appropriate optional parameters overriding those of this. [...]