Creates a linear gradient from endPoint[0] to endPoint[1]. If
colorStops is provided, colorStops[i] is a number from 0 to 1 that
specifies where color[i] begins in the gradient. If colorStops is not
provided, then two stops at 0.0 and 1.0 are implied. The behavior before
and after the radius is described by the tileMode argument.
Source
// TODO(mpcomplete): Consider passing a list of (color, colorStop) pairs
// instead.
Gradient.linear(List<Point> endPoints,
List<Color> colors,
[List<double> colorStops = null,
TileMode tileMode = TileMode.clamp]) {
if (endPoints == null || endPoints.length != 2)
throw new ArgumentError("Expected exactly 2 [endPoints].");
_validateColorStops(colors, colorStops);
final Float32List endPointsBuffer = _encodePointList(endPoints);
final Int32List colorsBuffer = _encodeColorList(colors);
final Float32List colorStopsBuffer = colorStops == null ? null : new Float32List.fromList(colorStops);
_constructor();
_initLinear(endPointsBuffer, colorsBuffer, colorStopsBuffer, tileMode.index);
}