【发布时间】:2020-08-03 04:02:24
【问题描述】:
我正在使用下面的代码来绘制矩形 DropDownWidget
class DropDownWidget extends StatelessWidget {
final List<String> _dropdownValues = [
"One",
"Two",
"Three",
"Four",
"Five"
]; //The list of values we want on the dropdown
@override
Widget build(BuildContext context) {
return Container(
padding: EdgeInsets.symmetric(horizontal: 10.0),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(15.0),
border: Border.all(
color: Colors.red, style: BorderStyle.solid, width: 0.80),
),
child: DropdownButtonHideUnderline(
child: DropdownButton(
hint: Text('Enter'),
items: _dropdownValues
.map((value) => DropdownMenuItem(
child: Text(value),
value: value,
))
.toList(),
onChanged: (String value) {},
isExpanded: true,
value: 'One',
),
),);
}
}
上面的代码给出了类似的下拉菜单
我想要这样的输出,可以吗?
【问题讨论】:
标签: flutter flutter-layout flutter-widget