flutter/examples/game/lib/power_bar.dart
Adam Barth 2aa79d5694 Remove old setFoo functions on Paint
We now just use Dart properties, which is more idiomatic.
2015-10-19 12:21:34 -07:00

22 lines
626 B
Dart

part of game;
class PowerBar extends NodeWithSize {
PowerBar(Size size, [this.power = 1.0]) : super(size);
double power;
Paint _paintFill = new Paint()
..color = new Color(0xffffffff);
Paint _paintOutline = new Paint()
..color = new Color(0xffffffff)
..strokeWidth = 1.0
..style = ui.PaintingStyle.stroke;
void paint(PaintingCanvas canvas) {
applyTransformForPivot(canvas);
canvas.drawRect(new Rect.fromLTRB(0.0, 0.0, size.width - 0.0, size.height - 0.0), _paintOutline);
canvas.drawRect(new Rect.fromLTRB(2.0, 2.0, (size.width - 2.0) * power, size.height - 2.0), _paintFill);
}
}