Drawing from Scratch
In this course, we do not use Container or SizedBox from the Material library. We use the Canvas.
Why?
Standard widgets have massive overhead. By using CustomPainter, you skip the widget tree complexity.
Implementation
dart class MyLowLevelWidget extends CustomPainter { @override void paint(Canvas canvas, Size size) { final paint = Paint()..color = Colors.blue; canvas.drawRect(Offset.zero & size, paint); }
@override bool shouldRepaint(covariant CustomPainter oldDelegate) => false; }
This is the fastest way to render a box in Flutter.