Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

control & disable a dropdown button in flutter?

Tags:

flutter

I wanted to control a drop-down button and make it unclickable using a button.

Is there any way to make it disable. Basically not allowing it able to change.

new DropdownButton(           value: animalName,           items: animals.map(             (String value) {               return new DropdownMenuItem<String>(                 value: value,                 child: new Text('$value'),               );             },           ).toList(),           onChanged: (value) {             setState(() {               animalName = value;             });           },         ), 

So this is the code I currently use on the drop-down button, but i cant disabled it.

like image 658
Daniel Mana Avatar asked Apr 06 '18 12:04

Daniel Mana


People also ask

What do u mean by Control?

1 : the power or authority to manage The city wanted local control of education. 2 : ability to keep within bounds or direct the operation of The fire is out of control. He lost control of the car. 3 : self-restraint I lost control and started yelling. 4 : regulation sense 2 price controls.

Is Control inspired by SCP?

While Control takes inspiration from The SCP Foundation, a retail SCP game wouldn't actually be possible due to how the work submitted to the website is licensed under Creative Commons copyright.

Is Control a good game?

Control's lore is rich and engrossing, and the best way to delve into it is by taking on combat challenges. The combat is experimental and satisfying, and the best way to get better at it is by exploring the game's fiction. If you're not into either of these elements, you won't like Control.

Is Control a AAA game?

Control – the AAA third-person action adventure game – is FREE for a limited time!


1 Answers

Found this in the DropdownButton docs:

If items or onChanged is null, the button will be disabled, the down arrow will be grayed out, and the disabledHint will be shown (if provided)

DropdownButton(   onChanged: null,   items: [...], ) 
like image 53
wamfous Avatar answered Sep 20 '22 09:09

wamfous