Questions tagged [flutter-dropdownbutton]

94 questions
15
votes
4 answers

The method 'showSnackBar' isn't defined for the type 'BuildContext'

Here i create a DropdownItemMenu which get the element from firebase collection, but it shows me an error The method 'showSnackBar' isn't defined for the type 'BuildContext' Container( margin: EdgeInsets.only(left: 16, right:…
Badi Ais
  • 161
  • 1
  • 1
  • 3
9
votes
5 answers

Highlight selected value in DropdownButton (like PopupMenuButton)

When a PopupMenuButton is pressed, the currently selected value is highlighted, but when a DropdownButton is pressed, the currently selected value is not highlighted. Is there a way to highlight the selected value of a DropdownButton? For…
Simpler
  • 1,317
  • 2
  • 16
  • 31
6
votes
1 answer

Flutter - How to select DropdownButton item in widget test

I tried selecting a DropdownButton item like this: import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:dropdown_test_sample/main.dart'; void main() { testWidgets('Select Dropdown item test',…
Joshua Erinosho
  • 212
  • 2
  • 9
5
votes
4 answers

App crashes when DropdownButton is clicked (Flutter)

So I created a DropdownButton in my app. The thing is that whenever I click the dropdown, the app crashes. I'm so confused because when I click other widgets like TextFormFields before clicking the DropdownButton it seems to work properly. Error…
Burikay
  • 83
  • 6
3
votes
2 answers

How to change dropdown default text color, when it is disabled?

When the dropdown is disabled it has this default black text color, which I want to change. There is an option to change the icon color but no option for text color. Any help would be greatly appreciated. DropdownButtonFormField( value:…
Mahan Marwat
  • 373
  • 1
  • 13
3
votes
3 answers

Open Flutter dropdown programmatically

I am trying to build a searchable dropdown which will load value from service on every button click. So, for that I have encapsulated DropDownButton and TextField in Stack Widget. On keypress we get response from api, so far so good. But after…
Yaseen
  • 214
  • 1
  • 11
3
votes
2 answers

Flutter: DropDownButton items below button

I want to create a pretty DropDownButton. Unfortunately, this seems to be pretty hard. While the design is fine, whenever I want to select a different item the list drops above the selection in a very ugly way. Below is a picture of the current…
spadel
  • 998
  • 2
  • 16
  • 40
3
votes
2 answers

Flutter: scrolling a list of DropdownButtons each containing 1k selections is too slow

I have a list of items (5-6 items) that are displayed using a ListView.builder. Each item contains a DropdownButton widget for the user to pick a number from 1 - 1000, thus containing 1000 DropdownMenuItems. I implemented it as shown below, but the…
Mena
  • 3,019
  • 1
  • 25
  • 54
2
votes
0 answers

Update dropdown items with setstate on focus not working

I want to update dropdown items with setState when data received from api. Dropdown items not update even though widget is rebuilt. I can only get updated dropdown items after unfocus and focus. Please point me out if something wrong in my…
2
votes
0 answers

Dropdown Focus not changing

I am using flutter for web. When I click on the dropdown but do not select any options, then when I click outside the dropdown menu, the focus is still there. But I have used Gesture Detector to change the focus by this- onTap: () { …
Asif Syeed
  • 81
  • 7
2
votes
2 answers

Flutter. How to implement editable text field with DropDownButton?

I am trying to implement a TextField with DropDown menu, just like DropdownButtonFormField but with ability to edit it like ordinary text field. So user have options to fill the field by hand or to make a choice from drop down…
Parafin
  • 89
  • 3
  • 7
2
votes
1 answer

How to have different text overflow style in DropdownButton in hint text and in the DropdownMenuItem in Flutter?

I want to set the overflow of hint text of DropdownButton to ellipsis, but I want to show the whole choice in the DropdownMenuItem when I open the dropdown list, so I set it to visible But what happens is that the hint text gets the "visible" effect…
Ammar Mohamed
  • 513
  • 1
  • 6
  • 16
2
votes
1 answer

Flutter DropdownButton - Dropdown shows up in different part of screen

I'm creating a dropdown to allow my users to select their preferred language. The dropdown looks good, but when I scroll to the very bottom of the screen and click on the DropdownButton, the resulting dropdown shows up in a totally different part of…
Martin Reindl
  • 989
  • 2
  • 15
  • 33
2
votes
3 answers

Failed assertion: line 1252 pos 12: 'widget.items!.where((DropdownMenuItem item) => item.value == widget.value).length == 1': is not true

I am getting this error in the console when I am trying to use flutter DropdownButton Widget. package:flutter/src/material/dropdown.dart': Failed assertion: line 1252 pos 12: 'widget.items!.where((DropdownMenuItem item) => item.value ==…
2
votes
1 answer

Dynamically change the value of a DropdownButton based on the value of another DropdownButton [FLUTTER]

I hope you are well. I have a little problem, I would like to dynamically change the value of a DropdownButton based on the value of another DropdownButton. Well, I'll explain where I'm at and what the problem is: First I have a list of StudyCycle…
1
2 3 4 5 6 7