Improve Performance

`_resize(fit)` was called on every Build.
`_resize` posts a WidgetsBinding frame callback unconditionally. If fit hasn't changed, this is wasted work.
This commit is contained in:
NBA2K1 2026-04-26 17:38:26 +02:00
parent 47f3296e9e
commit 3aa5c73dba

View file

@ -1948,7 +1948,10 @@ mp.register_script_message('call_button_${button.id}_long', button${button.id}lo
);
}
BoxFit? _lastFit;
void _resize(BoxFit fit) async {
if (fit == _lastFit) return;
_lastFit = fit;
// Wait for the widget tree to settle before updating fit
await WidgetsBinding.instance.endOfFrame;
if (mounted) {