Skip to content

Conversation

@TahaTesser
Copy link
Member

@TahaTesser TahaTesser commented Dec 28, 2021

fixes #53634
fixes #31641

This PR moves Input decoration for DropdownButtonFormField to DropdownButton, which is accessed by a private constructor for DropdownButtonFormField (this avoids this hack #53634 (comment), it can be really expensive to find layouts using this kinda hack to find inner gesture detector from DropdowButton) and adds InkWell to DropdownButton to match Material Design specs and most importantly fixes the tapping area fixes

The main reason for moving inputDecorator so inkWell size is equal to inputDecorator size
Adding InkWell to DropdownButton is required so DropdownButtonFormField has a bigger tappable area just like native Android.

Here is a native Android dropdown for reference

Flutter with this PR

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@flutter-dashboard flutter-dashboard bot added f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels. labels Dec 28, 2021
@werainkhatri werainkhatri changed the title Fix tappble area for DropdownFormField & add InkWell to DropdownButton Fix tappable area for DropdownButtonFormField & add InkWell to DropdownButton Jan 1, 2022
Copy link
Member

@werainkhatri werainkhatri left a comment

Choose a reason for hiding this comment

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

Just a few nits and queries.

@TahaTesser
Copy link
Member Author

TahaTesser commented Jan 14, 2022

cc; @gspencergoog
Can you please let me know If the private constructor approach is the way to go, I will update the PR for conflicts and fix semantics

@TahaTesser
Copy link
Member Author

@werainkhatri
I just pushed a couple of updates, can you please take a look?

@werainkhatri
Copy link
Member

Another issue I found:

DropdownButton used BoxDecoration to highlight when it had focus. Now that is handled by InkWell itself, so it should be removed, as the highlights overlap now.

Screenshot from 2022-01-19 16-00-33

https://github.com/flutter/flutter/blob/571a0708aaa00cc72332639459cb798e1965991b/packages/flutter/lib/src/material/dropdown.dart#L1474-L1479

@TahaTesser
Copy link
Member Author

@gspencergoog @werainkhatri
Is there anything else we need to do to land this please?

Copy link
Member

@werainkhatri werainkhatri left a comment

Choose a reason for hiding this comment

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

This LGTM and sorry about the delay. Just a few minor nit fixes.

Copy link
Contributor

@gspencergoog gspencergoog left a comment

Choose a reason for hiding this comment

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

32384589-a60f0e74-c078-11e7-9bc1-e5b5287aea9d

@fluttergithubbot fluttergithubbot merged commit cc2c902 into flutter:master Jan 28, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 28, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 28, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 28, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 28, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 28, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Feb 4, 2022
@TahaTesser TahaTesser deleted the dropdown_tap_fix branch February 4, 2022 07:52
@iqfareez
Copy link

iqfareez commented Mar 2, 2022

Hi. When can we expect this pr make its way to stable?

clocksmith pushed a commit to clocksmith/flutter that referenced this pull request Mar 8, 2022
@beamAkshay
Copy link

When we use helperText property then its include helperText in tappable area as well.

Annotation 2022-07-08 193809

auto-submit bot pushed a commit that referenced this pull request Jun 22, 2023
`_hasPrimaryFocus` variable and its related code is no longer needed after using `InkWell` for `DropdownButton` at #95906
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DropDownButtonFormField is not easily clickable when OutlineInputBorder is used. DropdownButton has no splash effect

7 participants