1
I’m new to Flutter and created a Dropdownbutton where it works perfectly. But I need the same when opened, do not fill the entire screen as shown in image 1 and 2. I need the Dropdownbutton open its current location downwards (shown in image 3), so that if the user regrets opening the Dropdownbutton can collect the Dropdown and not be required to select an option for the Dropdownbutton is collected or used from the return option of the device itself. This is possible or I will need to use another Widget?
Follow my code below:
DropdownButton<String>(
isExpanded: true,
value: expansionValue,
icon: Icon(Icons.arrow_downward),
iconSize: 28,
elevation: 16,
style: TextStyle(color: Colors.black, fontWeight: FontWeight.w600),
onChanged: (String newValue) {
setState(() {
expansionValue = newValue;
});
},
items: <String>['Box-1', 'Box-2', 'Box-3', 'Box-4','Box-5', 'Box-6',
'Box-7', 'Box-8', "Box-9", "Box-10", "Box-11", "Box-12", "Box-13",
"Box-14", "Box-15", "Box-16", "Box-17"]
.map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(value, style: TextStyle(fontSize: 18.0, fontWeight: FontWeight.w600)),
);
}).toList(),
),
Image 1
Image 2
Image 3 (how I need it to look)
That’s a problem Flutter hasn’t solved yet... as you can see in this Issue. If you want to apply a "workaround" (Famous Gambiarra) you can try what is suggested in this answer
– Matheus Ribeiro