RadialSteps class

A 2D radial stepping "gradient".

This class represent radial steps, abstracting out the arguments to the new ui.Gradient.radial constructor from dart:ui.

A normal RadialSteps has a center and a radius. The center point corresponds to 0.0, and the ring at radius from the center corresponds to 1.0. These lengths are expressed in fractions.

It is also possible to create a two-point (or focal pointed) RadialSteps (which is sometimes referred to as a two point conic gradient, but is not the same as a CSS conic gradient which corresponds to a SweepSteps).

A focal point and focalRadius can be specified similarly to center and radius, which will make the rendered gradient appear to be pointed or directed in the direction of the focal point. This is only important if focal and center are not equal or focalRadius is greater than 0.0 (as this case is visually identical to a normal RadialSteps).

One important case to avoid is having focal and center both resolve to Offset.zero when focalRadius is greater than 0.0. In such a case, a valid shader cannot be created by the framework.

The colors are described by a List<Color>. The stops list, if specified, must have the same length as colors. It specifies fractions of the radius between 0.0 and 1.0, giving concentric rings for each color stop. If it is null, a uniform distribution is assumed.

The region of the canvas beyond radius from the center is painted according to tileMode.

Typically this class is used with BoxDecoration, which does the painting. To use a RadialSteps to paint directly on a canvas, see createShader.

{@tool snippet}

The center example is this RadialSteps

the center example is this RadialSteps

final stepBowRadial = Container(
  decoration: BoxDecoration(
    gradient: RadialSteps(
      tileMode: TileMode.repeated,
      radius: 0.5,
      colors: [
        Colors.pink, Colors.purple, Colors.indigo, Colors.blue,
        Colors.green, Colors.yellow, Colors.orange, Colors.red,
      ],
    );

{@end-tool}

See also:

Inheritance
Available extensions

Constructors

RadialSteps({AlignmentGeometry center = Alignment.center, double radius = 0.5, required List<Color> colors, List<double>? stops, AlignmentGeometry? focal, double focalRadius = 0.0, TileMode tileMode = TileMode.clamp, GradientTransform? transform})
Construct a new RadialSteps type Gradient.
const

Properties

asNill Gradient

Available on Gradient, provided by the NillGradients extension

Gradient get asNill => nillify( /* this. */ runtimeType);
no setter
begin AlignmentGeometry

Available on Gradient, provided by the GradientUtils extension

If this is a linear-type Gradient, returns this.begin. Otherwise the fallback retrun value is Alignment.center.
no setter
center AlignmentGeometry
The center of this RadialSteps as an offset into the (-1.0, -1.0) x (1.0, 1.0) square describing the Gradient which will be mapped onto the paint box.
final
center AlignmentGeometry

Available on Gradient, provided by the GradientUtils extension

If this is a radial- or sweep-type Gradient, returns this.center. Otherwise the fallback retrun value is Alignment.center.
no setter
colors List<Color>
The colors the gradient should obtain at each of the stops.
finalinherited
distance double

Available on Gradient, provided by the GradientUtils extension

If this is a ShadedSteps-type Gradient, returns this.distance. Otherwise the fallback retrun value is 0.0.
no setter
end AlignmentGeometry

Available on Gradient, provided by the GradientUtils extension

If this is a linear-type Gradient, returns this.end. Otherwise the fallback retrun value is Alignment.center.
no setter
endAngle double

Available on Gradient, provided by the GradientUtils extension

If this is a sweep-type Gradient, returns this.endAngle. Otherwise the fallback retrun value is 0.0.
no setter
focal AlignmentGeometry?
The focal point of this RadialSteps. If specified, the RadialSteps will appear to be focused along the vector from center to focal.
final
focal AlignmentGeometry?

Available on Gradient, provided by the GradientUtils extension

If this is a radial-type Gradient, returns this.focal which may be null. Otherwise the fallback retrun value is null.
no setter
focalRadius double
The radius of the focal point of this RadialSteps as a fraction of the shortest side of the paint box.
final
focalRadius double

Available on Gradient, provided by the GradientUtils extension

If this is a radial-type Gradient, returns this.focalRadius. Otherwise the fallback retrun value is 0.0.
no setter
hashCode int
The hash code for this object.
no setteroverride
radius double
The radius of this RadialSteps as a fraction of the shortest side of the paint box.
final
radius double

Available on Gradient, provided by the GradientUtils extension

If this is a radial-type Gradient, returns this.radius. Otherwise the fallback retrun value is 0.0.
no setter
reversed Gradient

Available on Gradient, provided by the GradientUtils extension

Returns a copy of this Gradient with its List<Color> colors reversed as well as any potential stops.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
shadeFactor double

Available on Gradient, provided by the GradientUtils extension

If this is a ShadedSteps-type Gradient, returns this.shadeFactor. Otherwise the fallback retrun value is 0.
no setter
shadeFunction ColorArithmetic

Available on Gradient, provided by the GradientUtils extension

If this is a ShadedSteps-type Gradient, returns this.shadeFunction. Otherwise the fallback retrun value is Shades.withWhite.
no setter
softness double

Available on Gradient, provided by the GradientUtils extension

If this is a Steps-type Gradient, returns this.softness. Otherwise the fallback retrun value is 0.0.
no setter
startAngle double

Available on Gradient, provided by the GradientUtils extension

If this is a sweep-type Gradient, returns this.startAngle. Otherwise the fallback retrun value is 0.0.
no setter
steppedColors List<Color>

Available on Gradient, provided by the GradientUtils extension

If this is a Steps-type Gradient, returns this.steppedColors. Otherwise the fallback retrun value is colors.
no setter
steppedStops List<double>?

Available on Gradient, provided by the GradientUtils extension

If this is a Steps-type Gradient, returns this.steppedStops. Otherwise the fallback retrun value is stops.
no setter
stops List<double>?
A list of values from 0.0 to 1.0 that denote fractions along the gradient.
finalinherited
tileMode TileMode
How this RadialSteps should tile the plane beyond the outer ring at radius pixels from the center.
final
tileMode TileMode

Available on Gradient, provided by the GradientUtils extension

How this Gradient tiles in the plane beyond the region before its starting stop and after its ending stop.
no setter
transform GradientTransform?
The transform, if any, to apply to the gradient.
finalinherited

Methods

animate({required Animation<double> controller, Map<GradientAnimation, dynamic> storyboard = const {}, GradientCopyWith overrideCopyWith = spectrumCopyWith}) Gradient

Available on Gradient, provided by the GradientUtils extension

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, AlignmentGeometry? center, double? radius, AlignmentGeometry? focal, double? focalRadius, TileMode? tileMode, GradientTransform? transform}) RadialSteps
📋 Returns a new copy of this RadialSteps with any provided optional parameters overriding those of this.
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

Available on Gradient, provided by the GradientUtils extension

📋 Returns a new copy of this Gradient with any appropriate optional parameters overriding those of this.
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}) Gradient

Available on Gradient, provided by the GradientUtils extension

📋 Returns a new copy of this Gradient with any appropriate optional parameters overriding those of this.
createShader(Rect rect, {TextDirection? textDirection}) Shader
Creates a ui.Gradient.radial with duplicated colors and stops.
override
lerpFrom(Gradient? a, double t) Gradient?
Linearly interpolates from another Gradient to this.
override
lerpTo(Gradient? b, double t) Gradient?
Linearly interpolates from this to another Gradient.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
scale(double factor) RadialSteps
Returns a new RadialSteps with its colors scaled by the given factor. Since the alpha channel is what receives the scale factor, 0.0 or less results in a gradient that is fully transparent.
override
toString() String
A string representation of this object.
override
withOpacity(double opacity) Gradient
Returns a new Gradient with each color set to the given opacity.
inherited

Operators

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

Static Methods

lerp(RadialSteps? a, RadialSteps? b, double t) RadialSteps?
Copied from RadialGradient.
Linearly interpolate between two RadialStepss.
override