void _show_selected (Function tap) {
showModalBottomSheet(context: context, builder: (BuildContext context) {
return StatefulBuilder(builder: (bottomContext, setBottomSheetState) {
setSelectedState = setBottomSheetState;
// 在这里初始用bootomSheet的setState设置初始值时,在_popup_item(e, () { setBootomSheetState时会无法触发视图更新})
setBottomSheetState(() {
tap();
});
return Column(
children: <Widget>[
Container(
width: double.infinity,
margin: EdgeInsets.only(bottom: UIUtils.bottomBarH),
padding: EdgeInsets.fromLTRB(16, 16, 16, 24),
color: Colors.white,
height: 340,
// constraints: BoxConstraints(minHeight: 340),
child: Column(
children: <Widget>[
Text(
'请选择默认问诊单',
style: TextStyle(
fontSize: UIUtils.TextStyle(context).title.fontSize + 2
),
),
Padding(
padding: EdgeInsets.only(top: 16),
),
Expanded(
flex: 1,
child: ListView(
chi
flutter 内部一层的innerSetState设置了初始值,在innerSetState改变值也无法视图刷新
最新推荐文章于 2024-06-14 09:56:16 发布
本文探讨了在Flutter中使用innerSetState时遇到的问题,即为初始值设置innerSetState不会触发视图刷新,且可能影响后续用户操作的视图更新。建议在初始化时不使用innerSetState。
摘要由CSDN通过智能技术生成