Gradient.radial constructor

Gradient.radial(Offset center, double radius, List<Color> colors, [ List<double> colorStops, TileMode tileMode = TileMode.clamp ])

Creates a radial gradient centered at center that ends at radius distance from the center.

If colorStops is provided, colorStops[i] is a number from 0.0 to 1.0 that specifies where color[i] begins in the gradient. If colorStops is not provided, then only two stops, at 0.0 and 1.0, are implied (and color must therefore only have two entries).

The behavior before and after the radius is described by the tileMode argument. For details, see the TileMode enum.

If center, radius, colors, or tileMode are null, or if colors or colorStops contain null values, this constructor will throw a NoSuchMethodError.

Implementation

Gradient.radial(
  Offset center,
  double radius,
  List<Color> colors, [
  List<double> colorStops,
  TileMode tileMode = TileMode.clamp,
]) : assert(_offsetIsValid(center)),
     assert(colors != null),
     assert(tileMode != null),
     super._() {
  _validateColorStops(colors, colorStops);
  final Int32List colorsBuffer = _encodeColorList(colors);
  final Float32List colorStopsBuffer = colorStops == null ? null : new Float32List.fromList(colorStops);
  _constructor();
  _initRadial(center.dx, center.dy, radius, colorsBuffer, colorStopsBuffer, tileMode.index);
}