diff --git a/frontend/lib/map/map/screen_parent_resizer.dart b/frontend/lib/map/map/screen_parent_resizer.dart index 7a3b55616..13db1f989 100644 --- a/frontend/lib/map/map/screen_parent_resizer.dart +++ b/frontend/lib/map/map/screen_parent_resizer.dart @@ -31,12 +31,14 @@ class _ScreenParentResizer extends State { final currentOrientation = MediaQuery.of(context).orientation; final isOverDrawingSquare = currentOrientation != _lastBuildOrientation; - if (isOverDrawingSquare) { + // Delay setState by 2 frames. If we delay only by one frame, then Flutter is able to optimize this away. WidgetsBinding.instance!.addPostFrameCallback( - (_) => setState(() { - _lastBuildOrientation = currentOrientation; - }), + (_) => WidgetsBinding.instance!.addPostFrameCallback( + (_) => setState(() { + _lastBuildOrientation = currentOrientation; + }), + ), ); }