Closed albe-jj closed 5 days ago
Maybe related to https://github.com/flutter/flutter/issues/147253?
@albe-jj
Can you try making use of key
to see if it helps in your case or not ?
Also check https://github.com/flutter/flutter/issues/103266 for further reference.
@albe-jj Can you try making use of
key
to see if it helps in your case or not ? Also check #103266 for further reference.
DorpdownMenuEntry
has no property key https://api.flutter.dev/flutter/material/DropdownMenuEntry-class.html (key is for DropdownMenuItem
used in dropdown button)
Note that with DropdownButton
the selection is correct, it's when using DropdownMenu
that selection goes wrong
Maybe related to #147253?
indeed seems related
Thanks for the update. I was able to replicate the reported behavior.
The reported behavior occurs with test
and my test
items while selecting with respect to selection labels. The same doesn't occur while selecting bla
and test 1
.
Thanks for filing this issue! The default searching algorithm is to find the first matching item which contains the queried text. We can use searchCallback
to find the result exactly matching the query:) https://api.flutter.dev/flutter/material/DropdownMenu/searchCallback.html
Steps to reproduce
With the following code, when item with label
test
is selected the item with labelmy test
is selected instead, Although the object has different uuid. if I selectbla
ortest 1
then it works as expected.Expected results
if I select
test
thentest
should be highlighted the next time the menu is opened.Actual results
With the following code, when item with label
test
is selected the item with labelmy test
is selected instead, Although the object has different uuid. if I selectbla
ortest 1
then it works as expected.Code sample
Code sample
``` dart import 'package:flutter/material.dart'; void main() { runApp(MyApp()); } class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( title: 'Custom Dropdown Menu', home: DropdownMenuExample(), ); } } class DropdownMenuExample extends StatefulWidget { @override _DropdownMenuExampleState createState() => _DropdownMenuExampleState(); } class _DropdownMenuExampleState extends StateScreenshots or Video
Screenshots / Video demonstration
[Upload media here]Logs
Logs
```console [Paste your logs here] ```Flutter Doctor output
Doctor output
```console [✓] Flutter (Channel beta, 3.22.0-0.1.pre, on macOS 14.4.1 23E224 darwin-arm64, locale en-GB) [✗] Android toolchain - develop for Android devices ✗ Unable to locate Android SDK. Install Android Studio from: https://developer.android.com/studio/index.html On first launch it will assist you in installing the Android SDK components. (or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions). If the Android SDK has been installed to a custom location, please use `flutter config --android-sdk` to update to that location. [!] Xcode - develop for iOS and macOS (Xcode 15.3) ✗ Unable to get list of installed Simulator runtimes. [✓] Chrome - develop for the web [!] Android Studio (not installed) [✓] VS Code (version 1.87.2)```