Flutter .实心,宽度:0.80), ), 子对象:行(子对象:[ if(widget.label!=null&&widget.label.isNotEmpty) 填充物( 填充:边缘组。对称(水平:16), 子项:文本(widget.label), ), 下拉按钮( 值:_状态, 项目: ['Delivered'、'InRoute'、'Processed'].map((字符串值){ 返回下拉菜单项( 价值:价值, 子:文本( 价值 样式:TextStyle( 颜色:主题。背景。原色, 尺寸:14, fontWeight:fontWeight.w500, ), ), ); }).toList(), 一旦更改:(val)=>setState(()=>_status=val), ), ]), ); } }
试穿一下 屏幕截图Flutter .实心,宽度:0.80), ), 子对象:行(子对象:[ if(widget.label!=null&&widget.label.isNotEmpty) 填充物( 填充:边缘组。对称(水平:16), 子项:文本(widget.label), ), 下拉按钮( 值:_状态, 项目: ['Delivered'、'InRoute'、'Processed'].map((字符串值){ 返回下拉菜单项( 价值:价值, 子:文本( 价值 样式:TextStyle( 颜色:主题。背景。原色, 尺寸:14, fontWeight:fontWeight.w500, ), ), ); }).toList(), 一旦更改:(val)=>setState(()=>_status=val), ), ]), ); } },flutter,listview,dart,dropdown,Flutter,Listview,Dart,Dropdown,试穿一下 屏幕截图 谢谢你的帮助。我有一个轻微的阻滞剂。在我为我选择一个项目之前,复选框不会显示值。我知道你的代码是正确的,但我的错误可能是什么原因。你可以用你所做的实现编辑你的代码,以便我可以测试。请查看我更新的代码。感谢您的期待,我认为它不会显示任何值,因为您没有设置下拉按钮的值属性,所以在您更改该值之前,它一开始不会有值。在我共享的实现中,我使用defaultStatus作为第一个要显示的值。 ListView.b
谢谢你的帮助。我有一个轻微的阻滞剂。在我为我选择一个项目之前,复选框不会显示值。我知道你的代码是正确的,但我的错误可能是什么原因。你可以用你所做的实现编辑你的代码,以便我可以测试。请查看我更新的代码。感谢您的期待,我认为它不会显示任何值,因为您没有设置
下拉按钮的值
属性,所以在您更改该值之前,它一开始不会有值。在我共享的实现中,我使用defaultStatus
作为第一个要显示的值。
ListView.builder(
physics: NeverScrollableScrollPhysics(),
itemCount: mainBloc.orders.length,
itemBuilder: (BuildContext context, int index) {
return Container(
decoration: BoxDecoration(
border: Border.all(
color: HexColor("#240C44"),
width: 0.5),
color: HexColor("#180332"),
borderRadius:
BorderRadius.all(Radius.circular(4))),
margin: EdgeInsets.only(
top: 10, bottom: 10, left: 0, right: 0),
child: ListTile(
title: Row(
children: <Widget>[
new Image.asset(
"assets/images/order_list_image.png",
width: 40,
height: 40,
),
Spacer(),
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15.0),
color: mainBloc.orders[index].status=="enroute"?
HexColor("#FF9F1C"):
mainBloc.orders[index].status=="delivered"?
HexColor("#71F79F"):
Colors.white.withOpacity(0.6),
border: Border.all(
color: HexColor("#FF9F1C"),
style: BorderStyle.solid,
width: 0.80),
),
child: new DropdownButton<String>(
items: <String>['Delivered', 'Enroute', 'Processed'
].map((String value) {
return new DropdownMenuItem<String>(
value: value,
child: new Text(
value,
style: TextStyle(
color: primaryColor,
fontSize: 14,
fontFamily: 'CircularStd',
fontWeight: FontWeight.w500,
),
),
);
}).toList(),
onChanged: (_) {
},
),
),
SizedBox(
width: 20,
),
IconButton(
icon: Image.asset(
"assets/images/edit.png",
width: 15,
height: 15,
color: Colors.white,
), onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) =>
EditOrderPage(index:index)),
);
},
),
],
),
),
);
}),