toShader method
Implementation
@override
ui.Shader toShader(Rect rect, double? colorOpacity) {
Offset fromOffSet;
Offset toOffSet;
fromOffSet = Offset(rect.left + from.dx * rect.width, rect.top + from.dy * rect.height);
toOffSet = Offset(rect.left + to.dx * rect.width, rect.top + to.dy * rect.height);
List<Color> cl = [];
if (colorOpacity != null) {
for (var element in colors) {
cl.add(element.withOpacity(colorOpacity));
}
} else {
cl = colors;
}
return ui.Gradient.linear(fromOffSet, toOffSet, cl, colorStops, tileMode, matrix4);
}