fillLeftRightGradient method
void
fillLeftRightGradient()
override
Fill a rectangle (x
,y
, width
x height
) with a left right linear gradient.
See fillRightLeftGradient.
Implementation
@override
void fillLeftRightGradient(
num x, num y, num width, num height, PColor colorFrom, PColor colorTo) {
var xd = transform.xD(x);
var yd = transform.yD(y);
xd = canvasXD(xd);
yd = canvasYD(yd);
final widthD = canvasXD(width);
final heightD = canvasYD(height);
final rect = Rect.fromLTWH(xd, yd, widthD, heightD);
final paint = Paint()
..shader = ui.Gradient.linear(
Offset(xd, yd),
Offset((xd + widthD), yd),
[colorFrom.asColor, colorTo.asColor],
);
_widgetPainter.addOp((canvas, size) {
canvas.drawRect(rect, paint);
});
}