[英]Flutter dropdown alignment not proper
I want the dropdown like this with flutter我想要这样的下拉菜单颤动
Expected:预期的:
with flutter dropdownformfield I'm able to do something like使用颤振 dropdownformfield 我可以做类似的事情
As you can see, When I click the dropdown button, the menu items are overlapping the button.如您所见,当我单击下拉按钮时,菜单项与按钮重叠。 Please find the code below请在下面找到代码
DropdownButtonFormField(
isExpanded: false,
isDense: true,
items: classes.map((category) {
return new DropdownMenuItem(
value: category,
child: Row(
children: <Widget>[
Text(category),
],
));
}).toList()
,
onChanged: (newValue) {
// do other stuff
},
value: _classroom,
decoration: InputDecoration(
contentPadding: EdgeInsets.fromLTRB(10, 0, 10, 0),
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.white)),
hintText: "Select Class",
hintStyle: TextStyle(
color: Colors.grey[600],
),
),
)
is this achievable with dropdown widget?这可以通过下拉小部件实现吗? if not, how can i design custom dropdown widget?如果没有,我该如何设计自定义下拉小部件?
Thanks谢谢
Use flutter's dropdownbutton2 ,In which you the menuitems are aligned from the bottom of the button, and you can even verywell customize the menu items使用flutter的dropdownbutton2,菜单项从按钮底部对齐,甚至可以很好的自定义菜单项
Package: DropDownButton2包:下拉按钮2
For reference: Refer this link供参考:参考此链接
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.