Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add scrollPadding property to DropdownMenu#183109

Open
ishaquehassan wants to merge 2 commits intoflutter:masterfrom
ishaquehassan:fix-issue-182890-1772436710
Open

Add scrollPadding property to DropdownMenu#183109
ishaquehassan wants to merge 2 commits intoflutter:masterfrom
ishaquehassan:fix-issue-182890-1772436710

Conversation

@ishaquehassan
Copy link

Description

This change adds a scrollPadding property to DropdownMenu, forwarding it to the internal TextField widget.

DropdownMenu wraps a TextField internally but did not expose the scrollPadding parameter. Both TextField and SearchBar already provide this property, so DropdownMenu should forward it for consistency. The scrollPadding property controls the padding around the text field when it scrolls into view (e.g., when the keyboard appears), allowing developers to ensure the field remains visible with appropriate spacing.

The default value is EdgeInsets.all(20.0), matching TextField's default to preserve existing behavior.

This PR implements the analysis from my earlier comment on this issue.

Related Issues

Fixes #182890

Pre-launch Checklist

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

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.

This change adds a scrollPadding parameter to DropdownMenu, forwarding
it to the internal TextField. Both TextField and SearchBar already
expose this parameter, and since DropdownMenu wraps a TextField
internally, it should forward this parameter for consistency.

The default value is EdgeInsets.all(20.0) to match TextField's default
and preserve existing behavior.

Fixes flutter#182890
@github-actions github-actions bot added framework flutter/packages/flutter repository. See also f: labels. f: material design flutter/packages/flutter/material repository. labels Mar 2, 2026
Copy link
Contributor

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

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 introduces a scrollPadding property to the DropdownMenu widget, which is then forwarded to the internal TextField. The default value is set to EdgeInsets.all(20.0) for consistency with TextField. The changes also include new tests to verify that the scrollPadding property is correctly passed and that its default value is applied as expected.

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.

Add scrollPadding property to DropdownMenu

1 participant