在我的代码中Container(height: 1, color: UtilColors.grey),
未给出预期输出
Container(
margin: EdgeInsets.only(left: 52, right: 48),
child: DropdownButton<String>(
isExpanded: true,
//Container(height: 1, color: UtilColors.grey),
value: _selectedUser,
items: _userTypes.map((String value) {
return new DropdownMenuItem<String>(value: value, child: new Text(value));
}).toList(),
/* decoration: InputDecoration(contentPadding: EdgeInsets.only(left: 15), suffixIcon: IconButton(onPressed: () {
// _userTypes.map((String value){return new DropdownMenuItem<String>(value: value, child: new Text(value));}).toList();
}, icon: Icon(null),)),*/
icon: Icon(Icons.keyboard_arrow_down),
hint: Text(UtilString.userType),
onChanged: (value) => setState(() => _selectedUser = value),
),
),
最终通过DropdownButton-获得了解决方案
underline:容器(高度:2,color:Colors.deepPurpleAccent,(,
这将更改下拉下划线的颜色。
DropdownButtonFormField(
decoration: InputDecoration(
focusedBorder: new UnderlineInputBorder(
borderSide: BorderSide(
color: Colors.black
),),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Color(0xff22a39f), width: 2),
),
),
// iconEnabledColor: Color(0xff22a39f),
hint: Text("اختر صنف"),
value:selectedValueInDropDpownM ,
items: choosenResala?.ctegoriesDetails.map(( value) {
return DropdownMenuItem<String>(
value: value.catName,
child: Text(value.catName,style: TextStyle( fontSize:
screenWidth * 0.013,
fontWeight:
FontWeight.w400,color: Colors.black ),),
);
}).toList(),
onChanged: ( newVal) {
setState(() {
selectedValueInDropDpownM=newVal as String?;
});
},
)