toGradient property
Gradient?
get
toGradient
Implementation
Gradient? get toGradient {
if (paints.isEmpty) return null;
if (paints.isUnitary) return null;
if (style == DecorStyle.linear) {
return LinearGradient(
colors: paints,
begin: origin,
end: focus,
stops: paints.stops,
);
}
if (style == DecorStyle.radial) {
return RadialGradient(
colors: paints,
focal: origin,
center: focus,
stops: paints.stops,
);
}
if (style == DecorStyle.sweep) {
return SweepGradient(
colors: paints,
center: origin,
stops: paints.stops,
);
}
return null;
}