withOpacity method
Returns a new Gradient with each color set to the given opacity.
Implementation
@override
Gradient withOpacity(double opacity) {
final newColors = <Color>[];
for (final color in colors) {
newColors.add(color.withOpacity(opacity));
}
return _copyWith(
resolved,
colors: newColors,
stops: stops,
transform: transform,
tileMode: tileMode,
begin: begin,
end: end,
center: center,
radius: radius,
focal: focal,
focalRadius: focalRadius,
startAngle: startAngle,
endAngle: endAngle,
softness: softness,
shadeFunction: shadeFunction,
shadeFactor: shadeFactor,
distance: distance,
);
}