A high-performance, leaf render-object widget driven by a double progress signal.
SignalPainterWidget bypasses the entire widget build and layout phases, subscribing
directly to a progress signal and rendering on the canvas. When progress
updates,
only the GPU paint phase is run.
Example#
final progress = signal(0.0);
@override
Widget build(BuildContext context) {
return SignalPainterWidget(
progress: progress,
painter: (canvas, size, value) {
final paint = Paint()
..color = Colors.blue
..style = PaintingStyle.stroke
..strokeWidth = 4.0;
canvas.drawCircle(
Offset(size.width / 2, size.height / 2),
value * 50.0,
paint,
);
},
);
}
Constructors#
View Constructors
SignalPainterWidget({super.key, required this.progress, required this.painter})
Creates a new SignalPainterWidget.
Properties#
View Properties
core.ReadonlySignal progress
The progress signal whose value will be passed to painter.
void Function(Canvas canvas, Size size, double value) painter
The custom painting callback function.