fix more than needed rebuilds on canvas children

this used a stupid builderFunc instead of a widget so flutter wasn't able to optimise those widget builds and it was simply a blanket rebuild. Added more examples as well
This commit is contained in:
2025-07-26 17:47:42 +00:00
parent 96e55a7157
commit 7ad54a92cb
8 changed files with 427 additions and 12 deletions
+1 -1
View File
@@ -19,7 +19,7 @@ class _AppState extends State<App> {
for (int i = 0; i < 10; i++) {
controller.addChild(
Offset((i % 80) * 100.0, (i ~/ 80) * 100.0),
(_) => GestureDetector(
GestureDetector(
onTap: () {
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text('Tapped a container')));
controller.focusOnChild(context, i);