使用StatefulBuilder文章来源地址https://www.toymoban.com/news/detail-651844.html
_showDialogr() {
showDialog(
context: context,
builder: (BuildContext ctx) {
return StatefulBuilder(
builder: (BuildContext context, StateSetter setState) {
return Scaffold(
body: Column(
children: <Widget>[
Container(
height: 400,
padding: EdgeInsets.fromLTRB(8, 0, 8, 8),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
color: Colors.white,
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
SizedBox(
height: 15,
),
Expanded(
flex: 6,
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Row(
children: [
Expanded(
flex: 8,
child: DropdownButton<String>(
items: getList(),
hint: Text('请选择'),
value: Id,
onChanged: (String? str) {
setState(() {
Id = str;
});
},
elevation: 24,
style: TextStyle(
color: Colors.black,
fontSize: 16,
),
),
),
],
),
],
),
),
],
),
),
],
),
);
},
);
},
);
}
文章来源:https://www.toymoban.com/news/detail-651844.html
到了这里,关于解决flutter showDialog下拉框,复选框等无法及时响应的问题的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!