Open xiami006 opened 4 years ago
view中无法setState方法,使用fish redux框架的state数据是更新了,但是checkbox的状态没有实时刷新,需要重新打开底部弹出框才能刷新 Future _openModalBottomSheet(ParentCtrNetTimeState state, Dispatch dispatch, BuildContext context) async { int groupValue = 0; bool check=false; final option = await showModalBottomSheet( context: context, builder: (BuildContext context) { return Container( height: 400.0, child: Column( children: [ CheckboxListTile( title: Text( S.of(context).extuesday, style: TextStyle( color: Colors.black38, fontSize: setSp(Dimens.font_sp14), ), ), value: check, onChanged: (bool value) { check=value; //dispatch(ParentCtrNetTimeActionCreator.onUpdateMondayAction(value)); }, ), ], ), ); } );}
使用 StatefulBuilder
view中无法setState方法,使用fish redux框架的state数据是更新了,但是checkbox的状态没有实时刷新,需要重新打开底部弹出框才能刷新 Future _openModalBottomSheet(ParentCtrNetTimeState state, Dispatch dispatch, BuildContext context) async { int groupValue = 0; bool check=false; final option = await showModalBottomSheet( context: context, builder: (BuildContext context) { return Container( height: 400.0, child: Column( children:[
CheckboxListTile(
title: Text(
S.of(context).extuesday,
style: TextStyle(
color: Colors.black38,
fontSize: setSp(Dimens.font_sp14),
),
),
value: check,
onChanged: (bool value) {
check=value;
//dispatch(ParentCtrNetTimeActionCreator.onUpdateMondayAction(value));
},
),
],
),
);
}
);}