Unverified Commit bbec650b authored by Taha Tesser's avatar Taha Tesser Committed by GitHub

`DropdownButton`: Fix hint alignment when `selectedItemBuilder` is non-null. (#106731)

parent cf342254
...@@ -1397,17 +1397,17 @@ class _DropdownButtonState<T> extends State<DropdownButton<T>> with WidgetsBindi ...@@ -1397,17 +1397,17 @@ class _DropdownButtonState<T> extends State<DropdownButton<T>> with WidgetsBindi
int? hintIndex; int? hintIndex;
if (widget.hint != null || (!_enabled && widget.disabledHint != null)) { if (widget.hint != null || (!_enabled && widget.disabledHint != null)) {
Widget displayedHint = _enabled ? widget.hint! : widget.disabledHint ?? widget.hint!; final Widget displayedHint = _enabled ? widget.hint! : widget.disabledHint ?? widget.hint!;
if (widget.selectedItemBuilder == null) {
displayedHint = _DropdownMenuItemContainer(alignment: widget.alignment, child: displayedHint);
}
hintIndex = items.length; hintIndex = items.length;
items.add(DefaultTextStyle( items.add(DefaultTextStyle(
style: _textStyle!.copyWith(color: Theme.of(context).hintColor), style: _textStyle!.copyWith(color: Theme.of(context).hintColor),
child: IgnorePointer( child: IgnorePointer(
ignoringSemantics: false, ignoringSemantics: false,
child: displayedHint, child: _DropdownMenuItemContainer(
alignment: widget.alignment,
child: displayedHint,
),
), ),
)); ));
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment