toShader method
Implementation
@override
ui.Shader toShader(Rect rect,double? colorOpacity) {
Offset center = Offset(rect.left + rect.width / 2, rect.top + rect.height / 2);
double radius = max(rect.width, rect.height) * 0.5;
List<Color> cl=[];
if(colorOpacity!=null){
for (var element in colors) {
cl.add(element.withOpacity(colorOpacity));
}
}else{
cl=colors;
}
return ui.Gradient.radial(center, radius, cl, colorStops, tileMode, matrix4, focal, focalRadius);
}