RadialGradientPainter class

A 2D radial gradient.

LinearGradientPainter, RadialGradientPainter, and SweepGradientPainter can be used interchangeably in BoxDecorations, or can be used to build a Shader to paint directly onto a Canvas. See: createShader.

Inheritance
Implemented types

Constructors

RadialGradientPainter({AlignmentGeometry center = Alignment.center, double radius = 0.5, required List<Color> colors, List<double>? stops, TileMode tileMode = TileMode.clamp, AlignmentGeometry? focal, double focalRadius = 0.0, GradientTransform? transform, ColorSpace? colorSpace, bool invert = false, double density = 0.125})
A 2D radial gradient.
const

Properties

center AlignmentGeometry
The center of the gradient, 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.
finalinherited
colors List<Color>
The colors the gradient should obtain at each of the stops.
finalinherited
colorSpace ColorSpace?
The color space the colors of the gradient will be interpolated in.
final
density double
Defines the number of steps to generate in relation to the number of device pixels the gradient spans.
final
focal AlignmentGeometry?
The focal point of the gradient. If specified, the gradient will appear to be focused along the vector from center to focal.
finalinherited
focalRadius double
The radius of the focal point of gradient, as a fraction of the shortest side of the paint box.
finalinherited
hashCode int
The hash code for this object.
no setteroverride
invert bool
If false, the colors will be interpolated in the color space defined by the starting color within any pairing, however if true, the colors will be interpolated in the space defined by the ending color.
final
radius double
The radius of the gradient, as a fraction of the shortest side of the paint box.
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stops List<double>?
A list of values from 0.0 to 1.0 that denote fractions along the gradient.
finalinherited
tileMode TileMode
How this gradient should tile the plane beyond the outer ring at radius pixels from the center.
finalinherited
transform GradientTransform?
The transform, if any, to apply to the gradient.
finalinherited

Methods

createShader(Rect rect, {TextDirection? textDirection}) Shader
Creates a Shader for this gradient to fill the given rect.
override
lerpFrom(Gradient? a, double t) Gradient?
Linearly interpolates from another Gradient to this.
inherited
lerpTo(Gradient? b, double t) Gradient?
Linearly interpolates from this to another Gradient.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
scale(double factor) RadialGradient
Returns a new RadialGradient with its colors scaled by the given factor.
override
toString() String
A string representation of this object.
inherited

Operators

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