File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed
packages/dropdown_button2 Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change 11## UNRELEASED
22
3- - Avoid dropdown internal FocusNode listener leak when replaced by an external FocusNode
3+ - Avoid dropdown internal FocusNode listener leak when replaced by an external FocusNode.
4+ - Fix incorrect dropdown position when resizing the window rapidly on web, closes #395 .
45
56## 3.0.0-beta.22
67
Original file line number Diff line number Diff line change @@ -546,11 +546,17 @@ class _DropdownButton2State<T> extends State<DropdownButton2<T>> with WidgetsBin
546546
547547 @override
548548 void didChangeMetrics () {
549- //This fix the bug of calling didChangeMetrics() on iOS when app starts
549+ // This fixes the bug of calling didChangeMetrics() on iOS when app starts.
550550 if (_buttonRect.value == null ) {
551551 return ;
552552 }
553- _buttonRect.value = _getButtonRect ();
553+
554+ // Defer rect calculation to next frame to ensure layout is complete and dimensions are accurate.
555+ WidgetsBinding .instance.addPostFrameCallback ((_) {
556+ if (mounted && _buttonRectKey.currentContext != null ) {
557+ _buttonRect.value = _getButtonRect ();
558+ }
559+ });
554560 }
555561
556562 TextStyle ? get _textStyle => widget.style ?? Theme .of (context).textTheme.titleMedium;
You can’t perform that action at this time.
0 commit comments