[英]dropdown button in flutter
i want make drop down like this, i already add sizedbox(width : 20), but nothing happen This my Dropdown now , Sry this is my first time using flutter, This is my code我想要像这样下拉,我已经添加了 sizedbox(width : 20),但什么也没发生,这是我的 Dropdown 现在,Sry 这是我第一次使用 flutter,这是我的代码
Container(容器(
margin: EdgeInsets.symmetric(horizontal: 20),
height: 60,
width: double.infinity,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(25),
border: Border.all(color: Colors.black38),
),
child: Stack(
children: <Widget>[
Icon(
Icons.pin_drop,
color: Colors.orange,
size: 36,
),
SizedBox(width: 20,),
Expanded(
child: DropdownButton(
isExpanded: true,
underline: SizedBox(),
icon: Icon(
Icons.arrow_drop_down,
),
value: "Jl. P. Diponegoro",
items: ['Jl. P. Diponegoro', 'Jl. Juanda', 'Jl. Perjuangan']
.map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(value),
);
}).toList(),
onChanged: (value) {},
),
),
],
),
),
I think this is what you want -我想这就是你想要的——
Container(
margin: EdgeInsets.symmetric(horizontal: 20),
padding: EdgeInsets.only(left: 10.0,right: 10.0),
height: 60,
width: double.infinity,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(25),
border: Border.all(color: Colors.black38),
),
child: Row(
children: [
Icon(
Icons.pin_drop,
color: Colors.orange,
size: 36,
),
SizedBox(width: 20,),
Expanded(
child: DropdownButton(
isExpanded: true,
underline: SizedBox(),
icon: Icon(
Icons.arrow_drop_down,
),
value: "Jl. P. Diponegoro",
items: ['Jl. P. Diponegoro', 'Jl. Juanda', 'Jl. Perjuangan']
.map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(value),
);
}).toList(),
onChanged: (value) {},
),
),
],
),
),
It will look something like this -它看起来像这样 -
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.