颤动的底部表固定无法刷新主页
底部表格中的固定剂即使使用statefulwidget也无法正常工作...我想在弹出底部表格之后刷新父的显示,
我应该在void中调用setState吗?如何做?
ElevatedButton(
...
onPressed: () {
BottomSheet(context, id, expiry);
},
...
),
void BottomSheet(BuildContext context, String id, String expiry) {
showModalBottomSheet(
context: context,
isScrollControlled: true,
....
),
),
child: BottomSheetWidget(id, expiry),
),
);
}
class BottomSheetWidget extends StatefulWidget {
....
}
class _BottomSheetWidgetState extends State<BottomSheetWidget> {
..
onTap: () {
setState(() {
updated parent data here.....
});
Navigator.pop(context);
},
....
}
the setstate in bottomsheet is not working even using statefulwidget... i want to refresh the display of parent after popping bottomsheet
should i call setstate in void instead? how to do this ?
ElevatedButton(
...
onPressed: () {
BottomSheet(context, id, expiry);
},
...
),
void BottomSheet(BuildContext context, String id, String expiry) {
showModalBottomSheet(
context: context,
isScrollControlled: true,
....
),
),
child: BottomSheetWidget(id, expiry),
),
);
}
class BottomSheetWidget extends StatefulWidget {
....
}
class _BottomSheetWidgetState extends State<BottomSheetWidget> {
..
onTap: () {
setState(() {
updated parent data here.....
});
Navigator.pop(context);
},
....
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试使用MaterialPageroute重建父页面的显示
Try using MaterialPageRoute to rebuild the display of the parent page
在ShowModelBottomSheet()的末尾致电。
Call .then method at the end of showModelBottomSheet()