Skip to content

[material_ui] Disable the DropdownButtonFormField decoration when the field is disabled - #13473

Merged
auto-submit[bot] merged 2 commits into
flutter:mainfrom
theprantadutta:material_ui/dropdown-form-field-disabled-decoration
Nov 5, 2026
Merged

auto-submit[bot] merged 2 commits into
flutter:mainfrom
theprantadutta:material_ui/dropdown-form-field-disabled-decoration

Conversation

@theprantadutta

Copy link
Copy Markdown
Contributor

DropdownButtonFormField passes its decoration to InputDecorator through DropdownButton, but nothing set the decoration's enabled. InputDecorator only uses its disabled colors and borders, and only ignores hovering (isHovering checks decoration.enabled), when the decoration is disabled. So a field disabled with enabled: false, or with a null onChanged, kept its enabled border and fill and still changed color on hover. The selected item and the icon already turned grey, because DropdownButton styles those from its own enabled state.

The fix sets enabled on the decoration in _DropdownButtonState.build from the dropdown's own enabled state. TextField does the same before it builds its InputDecorator, so a disabled dropdown and a disabled text field in the same form now look alike. A decoration passed in with enabled: false stays disabled, as before.

Tests

One regression test in dropdown_form_field_test.dart checks the decoration that InputDecorator gets: enabled with an onChanged, disabled with enabled: false, and disabled with no enabled and a null onChanged. It fails on main and passes with the fix. dropdown_form_field_test.dart, dropdown_test.dart and input_decorator_test.dart all pass (724 tests), as does the show_date_picker.2 example test, which is the example that uses DropdownButtonFormField.

Fixes flutter/flutter#195192

Pre-Review Checklist

I used AI tooling while working on this, and reviewed and tested all of it myself.

Footnotes

  1. Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. ↩ ↩2

… field is disabled

The dropdown passed its input decoration to InputDecorator without
setting enabled, so a disabled field kept its enabled colors and border
and still reacted to hover. Mark the decoration disabled when the
dropdown is, as TextField does.

Fixes flutter/flutter#195192

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates DropdownButtonFormField to ensure its decoration is disabled when the field itself is disabled, preventing it from reacting to hover or using enabled colors. This is achieved by setting the enabled property of the InputDecoration in dropdown.dart. A regression test has been added to verify this behavior under different disabled states, along with a pending changelog entry. There are no review comments, so no additional feedback is provided.

@QuncCccccc QuncCccccc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you for the fix!

@QuncCccccc QuncCccccc added the CICD Run CI/CD label Nov 5, 2026
@flutter-dashboard flutter-dashboard Bot removed the CICD Run CI/CD label Nov 5, 2026
@theprantadutta

Copy link
Copy Markdown
Contributor Author

The two red jobs here are tool unit tests in Linux repo_checks and Windows_x64 repo_tools_tests. MockGitDir didn't match package:git 2.5.0, which #13544 fixed on main. I've merged main into this branch to pick that up, so this will need CICD again. Thanks for the review!

@QuncCccccc QuncCccccc added the CICD Run CI/CD label Nov 5, 2026

@elliette elliette left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@elliette elliette added the autosubmit Merge PR when tree becomes green via auto submit App label Nov 5, 2026
@auto-submit
auto-submit Bot merged commit aa134bb into flutter:main Nov 5, 2026
14 checks passed
flutter-zl pushed a commit to NemesisDevX/flutter that referenced this pull request Nov 6, 2026
flutter/packages@0478162...63881f9

2026-11-06 [email protected] [material_ui] Paint Dialog.fullscreen
background color behind the keyboard (flutter/packages#13244)
2026-11-05 [email protected] [material_ui] Add tabBar/tab
roles and expanded state semantics (flutter/packages#13176)
2026-11-05 [email protected]
[material_ui] Disable the DropdownButtonFormField decoration when the
field is disabled (flutter/packages#13473)
2026-11-05 [email protected] [material_ui] Fix Switch throwing when first
painted mid-animation (flutter/packages#13496)
2026-11-05 [email protected] [various] Add
engineIdentifier to fake plugin registrars (flutter/packages#13574)
2026-11-05 [email protected] [google_sign_in]
Allow GoogleSignIn-iOS 10 (flutter/packages#13306)
2026-11-05 [email protected] [material_ui] Hit
test the floating label of InputDecorator at its painted position
(flutter/packages#13326)
2026-11-05 [email protected] [material_ui] Fix InputDecorator
intrinsic height when isDense or isC… (flutter/packages#13522)
2026-11-05 [email protected] [material_ui] Paint Scaffold
persistent bottom sheet background color behind the keyboard
(flutter/packages#13242)
2026-11-05 [email protected] [image_picker_ios] PR 5/5 Switch
Pigeon to Swift and finish the Objective-C to Swift migration.
(flutter/packages#13493)

If this roll has caused a breakage, revert this CL and set the roller
to dry run mode using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC [email protected] on the revert to ensure that a
human
is aware of the problem.

To file a bug in Flutter:
https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit Merge PR when tree becomes green via auto submit App CICD Run CI/CD p: material_ui triage-design Should be looked at in design triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[material_ui] DropdownButtonFormField: InputDecoration looks enabled and reacts to hover when enabled: false

3 participants