icemanbsi / searchable_dropdown

MIT License
107 stars 162 forks source link

Return old value after first select. #55

Open boungly opened 4 years ago

boungly commented 4 years ago

Current API Version searchable_dropdown: ^1.1.3

Flutter Doctor

[✓] Flutter (Channel stable, v1.12.13+hotfix.9, on Mac OS X 10.15.3 19D76, locale en-KH)

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 11.4)
[✓] Android Studio (version 3.4)
[✓] VS Code (version 1.44.2)
[✓] Connected device (2 available)

• No issues found!

[Note: The problem is not 100% occurred, but mostly it happens on iOS below 13 and also Android Emulator (API R)]

The problem is

  1. when we first launch the app and selected the value from the dropdown, it returns the correct value back. (exp: Select A and it return A)
  2. But when I try to select a new value [B] from dropdown again, it returns the old value of [A] instead.

It sounds weird, but the problem sometimes disappears when I tried to clean the project a few times.

My BaseDropDownTextField class. BaseDropDownTextField.log

boungly commented 4 years ago

UPDATE NOTE This problem seems to happen randomly, I've tried on my iPhoneXS 13.3, the problem also happens.

++ @lcuis @icemanbsi

boungly commented 4 years ago

NOTE This is record from my iPhoneXS.

ezgif com-video-to-gif

atta1234 commented 4 years ago

same problum ,is there any way to reset the dropdown,

lulumeimei commented 4 years ago

I have same issue on version 1.1.3. This problem solved after rollback to version 1.1.2

boungly commented 4 years ago

I found out that the problem happened when my class is using MediaQuery.of(context).size.---. I've fixed the problem by removing that. But I don't know the exact cause of that too.

burakhayirli commented 4 years ago

i have same issue already. İs there any body solved that problem? May you help please?

rvats011990 commented 4 years ago

i have same issue already. İs there any body solved that problem? May you help please?

PhilDevs94 commented 4 years ago

It seems that @boungly have the right answer but anyone can use it with MediaQuery.... ? I need it for responsive devices using larger text

pkmangukiya commented 4 years ago

This is the major issue, for me this is the happening in all times and i have tried different 4 devices and its also happening in all devices.

pkmangukiya commented 4 years ago

a lot of hard work I recognized it and fixed it. Value : this is the actual create a issue

SearchableDropdown(
 value: selectedState,      ------- // remove or comment this line
 items: stateDropdownItems,
 hint: Text('Select a State'),
 searchHint: new Text(
     'Search a State' ),
       onChanged: (value) {
             setState(() {
                selectedState = value;
               });
       },
      isExpanded: true,
  )`
pkmangukiya commented 4 years ago

a lot of hard work I recognized it and fixed it. Value : this is the actual create a issue

SearchableDropdown(
 value: selectedState,      ------- // remove or comment this line
 items: stateDropdownItems,
 hint: Text('Select a State'),
 searchHint: new Text(
     'Search a State' ),
       onChanged: (value) {
             setState(() {
                selectedState = value;
               });
       },
      isExpanded: true,
  )`

For solve this : https://github.com/icemanbsi/searchable_dropdown/issues/55#issuecomment-639377263

Alyahya-A commented 4 years ago

I have the same issue, but I found anther plugin. It's have a lot of features (such as InputDecoration 😍), and it's look like the TextFormField(). So your UI will be the same.

I recommend you to use this amazing plugin : dropdown_search

PhilTran1994 commented 4 years ago

a lot of hard work I recognized it and fixed it. Value : this is the actual create a issue

SearchableDropdown(
 value: selectedState,      ------- // remove or comment this line
 items: stateDropdownItems,
 hint: Text('Select a State'),
 searchHint: new Text(
     'Search a State' ),
       onChanged: (value) {
             setState(() {
                selectedState = value;
               });
       },
      isExpanded: true,
  )`

Well but if you remove this line, how can you initialize value ?