Skip to content

Conversation

@kazbeksultanov
Copy link
Contributor

@kazbeksultanov kazbeksultanov commented Dec 10, 2025

The documentation for DropdownMenu's controller and initialSelection properties has been updated. It now explicitly states that clearing the text field requires using a TextEditingController's clear() method, and that setting initialSelection to null will not clear the text. A code snippet demonstrating how to clear the text field has also been added.

Fix for: #177599

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.

talabat.com Talabat Flutter PRs

The documentation for `DropdownMenu`'s `controller` and `initialSelection` properties has been updated. It now explicitly states that clearing the text field requires using a `TextEditingController`'s `clear()` method, and that setting `initialSelection` to null will not clear the text. A code snippet demonstrating how to clear the text field has also been added.
@github-actions github-actions bot added framework flutter/packages/flutter repository. See also f: labels. f: material design flutter/packages/flutter/material repository. labels Dec 10, 2025
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 clarifies the documentation for DropdownMenu's controller and initialSelection properties, explaining how to programmatically clear the text field. The changes are clear and helpful, adding explicit instructions and a code snippet. I've suggested a couple of minor wording tweaks to further improve clarity and consistency in the documentation.

I am having trouble creating individual review comments. Click here to see my feedback.

packages/flutter/lib/src/material/dropdown_menu.dart (401-406)

medium

For improved clarity and consistency, I suggest a couple of minor wording changes in the documentation for initialSelection.

  1. On line 402, explicitly use [initialSelection] instead of this to avoid any ambiguity.
  2. On line 405, rephrasing to ...call its [TextEditingController.clear] method. would make it more consistent with the documentation for the controller property.
/// text field only if the new value exists in [dropdownMenuEntries]. Setting
/// [initialSelection] to null does NOT clear the text field.
///
/// To programmatically clear the text field, use a [TextEditingController]
/// and call its [TextEditingController.clear] method. See [controller] for more
/// information.

@dkwingsmt dkwingsmt requested a review from QuncCccccc December 10, 2025 19:10
@kazbeksultanov kazbeksultanov force-pushed the dropdown_menu_text_clear_doc_enhancement branch from 4847729 to f8a8f52 Compare December 15, 2025 13:33
The `{@tool snippet}` and `{@end-tool}` tags are unnecessary for a simple code block in the documentation.
Copy link
Contributor

@QuncCccccc QuncCccccc left a comment

Choose a reason for hiding this comment

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

Thanks for adding the doc improvements! Overall looks good! Left some comments below.

@kazbeksultanov
Copy link
Contributor Author

@QuncCccccc resolved the comments 👍

@kazbeksultanov
Copy link
Contributor Author

@QuncCccccc related to Linux analyze check. For me, it doesn't make any sense.
It's all in 1 line, and seems like it's considering it to be part of code, not the doc comment I believe.

Is there any suggestion how to fix it?

Or I can remove the dart example at all, even though I see it to be better.

packages/flutter/lib/src/material/dropdown_menu.dart:439:7: Functions must have an explicit list of parameters (top-level declaration) (missing_function_parameters)
packages/flutter/lib/src/material/dropdown_menu.dart:439:7: Missing type annotation (top-level declaration) (strict_top_level_inference)
packages/flutter/lib/src/material/dropdown_menu.dart:439:7: The name 'myController' is already defined (top-level declaration) (duplicate_definition)
packages/flutter/lib/src/material/dropdown_menu.dart:439:19: A function body must be provided (top-level declaration) (missing_function_body)
packages/flutter/lib/src/material/dropdown_menu.dart:439:19: Expected a method, getter, setter or operator declaration (top-level declaration) (expected_executable)
packages/flutter/lib/src/material/dropdown_menu.dart:439:20: Missing type annotation (top-level declaration) (strict_top_level_inference)
packages/flutter/lib/src/material/dropdown_menu.dart:439:27: A function body must be provided (top-level declaration) (missing_function_body)

@kazbeksultanov
Copy link
Contributor Author

Removed the example code and Linux analyze passed. @QuncCccccc what do you think, is it ok?

Copy link
Contributor

@QuncCccccc QuncCccccc left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for adding the doc enhancement.

Copy link
Member

@loic-sharma loic-sharma left a comment

Choose a reason for hiding this comment

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

LGTM once this comment is addressed: #179676 (comment)

kazbeksultanov and others added 2 commits December 23, 2025 18:36
Co-authored-by: Loïc Sharma <737941+loic-sharma@users.noreply.github.com>
Co-authored-by: Loïc Sharma <737941+loic-sharma@users.noreply.github.com>
@victorsanni victorsanni added the autosubmit Merge PR when tree becomes green via auto submit App label Dec 23, 2025
@auto-submit auto-submit bot added this pull request to the merge queue Dec 23, 2025
Merged via the queue into flutter:master with commit efce5d7 Dec 23, 2025
71 checks passed
@flutter-dashboard flutter-dashboard bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Dec 23, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Dec 23, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Dec 24, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Dec 24, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Dec 24, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Dec 25, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Dec 25, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Dec 26, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Dec 26, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Dec 27, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Dec 27, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Dec 28, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Dec 28, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Dec 29, 2025
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Dec 29, 2025
Roll Flutter from 6ff7f30 to 60d8165 (32 revisions)

flutter/flutter@6ff7f30...60d8165

2025-12-29 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from xn1U9DUFEpB4f6vG-... to DdllqZRZYriOd7Q8v... (flutter/flutter#180356)
2025-12-28 engine-flutter-autoroll@skia.org Roll Dart SDK from 17d51009282c to df175c998021 (1 revision) (flutter/flutter#180349)
2025-12-28 engine-flutter-autoroll@skia.org Roll Dart SDK from d4a92c2c69bf to 17d51009282c (1 revision) (flutter/flutter#180346)
2025-12-28 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from jVkEEUxyGeemuu2HE... to xn1U9DUFEpB4f6vG-... (flutter/flutter#180343)
2025-12-27 engine-flutter-autoroll@skia.org Roll Dart SDK from 3b84125003a1 to d4a92c2c69bf (1 revision) (flutter/flutter#180331)
2025-12-27 engine-flutter-autoroll@skia.org Roll Skia from e6e535aec613 to c29a475066f5 (1 revision) (flutter/flutter#180322)
2025-12-27 ahmedsameha1@gmail.com Make sure that a WidgetsApp doesn't crash in 0x0 environment (flutter/flutter#180224)
2025-12-27 ahmedsameha1@gmail.com Make sure that an AnimatedSize doesn't crash in 0x0 environment (flutter/flutter#180174)
2025-12-27 ahmedsameha1@gmail.com Make sure that an AnimatedGrid doesn't crash in 0x0 environment (flutter/flutter#180159)
2025-12-27 ahmedsameha1@gmail.com Make sure that an AnimatedCrossFade does not crash in 0x0 environment (flutter/flutter#180088)
2025-12-27 ahmedsameha1@gmail.com Make sure that an AnimatedList doesn't crash in 0x0 environment (flutter/flutter#180123)
2025-12-26 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from mZlbuHta7S71Quawk... to jVkEEUxyGeemuu2HE... (flutter/flutter#180317)
2025-12-26 engine-flutter-autoroll@skia.org Roll Dart SDK from 6b2c3716be54 to 3b84125003a1 (1 revision) (flutter/flutter#180316)
2025-12-26 engine-flutter-autoroll@skia.org Roll Dart SDK from 18f6751c5ccc to 6b2c3716be54 (1 revision) (flutter/flutter#180252)
2025-12-26 engine-flutter-autoroll@skia.org Roll Skia from 07c59737d265 to e6e535aec613 (1 revision) (flutter/flutter#180303)
2025-12-25 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from 2q71ydbnIhmBUiNOF... to mZlbuHta7S71Quawk... (flutter/flutter#180290)
2025-12-25 engine-flutter-autoroll@skia.org Roll Skia from 6d0a1b03e9c7 to 07c59737d265 (1 revision) (flutter/flutter#180289)
2025-12-25 engine-flutter-autoroll@skia.org Roll Skia from 2b5d93b62a3f to 6d0a1b03e9c7 (1 revision) (flutter/flutter#180279)
2025-12-25 engine-flutter-autoroll@skia.org Roll Skia from 3544942c9d42 to 2b5d93b62a3f (1 revision) (flutter/flutter#180276)
2025-12-24 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from 5EgkVbjGVZmCFPdtR... to 2q71ydbnIhmBUiNOF... (flutter/flutter#180274)
2025-12-24 engine-flutter-autoroll@skia.org Roll Packages from 5e3a766 to 2164da9 (4 revisions) (flutter/flutter#180271)
2025-12-24 engine-flutter-autoroll@skia.org Roll Skia from 988a48f7a944 to 3544942c9d42 (1 revision) (flutter/flutter#180267)
2025-12-24 fluttergithubbot@gmail.com Marks Mac_arm64_mokey native_assets_android to be unflaky (flutter/flutter#180263)
2025-12-24 engine-flutter-autoroll@skia.org Roll Skia from 51a05ce05880 to 988a48f7a944 (1 revision) (flutter/flutter#180256)
2025-12-24 34465683+rkishan516@users.noreply.github.com fix: exclude semantics for disabled dates (flutter/flutter#178981)
2025-12-24 engine-flutter-autoroll@skia.org Roll Skia from 7fe9b93153f8 to 51a05ce05880 (1 revision) (flutter/flutter#180253)
2025-12-24 116356835+AbdeMohlbi@users.noreply.github.com Enhance documentation for sortable column behavior (flutter/flutter#180011)
2025-12-24 engine-flutter-autoroll@skia.org Roll Skia from a0f18947bc1b to 7fe9b93153f8 (4 revisions) (flutter/flutter#180247)
2025-12-23 engine-flutter-autoroll@skia.org Roll Skia from bdb147ae3040 to a0f18947bc1b (2 revisions) (flutter/flutter#180241)
2025-12-23 engine-flutter-autoroll@skia.org Roll Dart SDK from 94b05f717ba3 to 18f6751c5ccc (1 revision) (flutter/flutter#180236)
2025-12-23 kazbek.sultanov.doc@gmail.com docs: clarify dropdown menu text clearing (flutter/flutter#179676)
2025-12-23 flar@google.com New optimized general convex path shadow algorithm (flutter/flutter#178370)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC stuartmorgan@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: 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

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.

4 participants