1

I have an extended CustomPainter class inside a MaterialApp widget tree. Unfortunately, the paint method gets invoked multiple times during the intrinsic Material design animations (for instance when hovering over a BottomNavigationBarItem or when the Drawer opens).

This happens even though the shouldRepaint method returns always false.

How can I avoid this?

user2428094
  • 1,643
  • 2
  • 10
  • 6
  • you cannot avoid this, of course you can wrap it with `RepaintBoundary` widget but this does not pay off really - btw what's wrong with the current behaviour? – pskink Jan 23 '23 at 22:13
  • I just want the app to be more energy efficient and avoid unnecessary canvas repaints. – user2428094 Jan 24 '23 at 06:51
  • so use `RepaintBoundary` as a parent to `CustomPaint` – pskink Jan 24 '23 at 15:31
  • but as I said you should not worry about those "extra" repaints, it does not really pays off – pskink Jan 24 '23 at 18:09

0 Answers0