我如何为DropdownButton项目添加下划线,我已经尝试过如下所示的下划线,但是没有用
DropdownButton<String>(
isExpanded: true,
hint: Text("Status"),
value: value.selected,
underline: Container(
height: 2,
color: Colors.deepPurpleAccent,
),
items: items
.map((key, value) {
return MapEntry(
key,
DropdownMenuItem<String>(
value: key,
child: Text(value),
));
})
.values
.toList(),
onChanged: (String val) {
value.selected = val;
},
)
答案 0 :(得分:0)
SizedBox(
width: 100.0,
child: DropdownButtonFormField<int>(
decoration: InputDecoration(
border: UnderlineInputBorder(
borderSide:
BorderSide(color: Colors.white))),
value: 2,
items: <DropdownMenuItem<int>>[
DropdownMenuItem<int>(
value: 1,
child: Text("Owner"),
),
DropdownMenuItem<int>(
value: 2,
child: Text("Member"),
),
],
),