Flutter:通过向下拖动或 Navigator.pop 检查模态底部工作表是否已关闭
showCupertinoModalBottomSheet(
expand: true,
context: context,
backgroundColor: ColorPalettes.white,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(10),
topRight: Radius.circular(10),
),
),
isDismissible: true,
builder: (rootContext) => ManageSavingsPlanSheet(
argument: ManageSelectArgument(
iban: widget.argument.iban,
cashBalance: widget.argument.cashBalance,
digitalDepotAccountId: widget.argument.digitalDepotAccountId,
withdrawBalance: widget.argument.withdrawBalance,
canWithdraw: widget.argument.canWithdraw,
isPaused: widget.argument.isPaused,
),
),
).then((_) => _getSavingsPlanDetail(context));
我们可以通过向下拖动或通过 Navigator.pop
检查模式底部表单是否关闭?
因为我有一个条件,当模态被 Navigator.pop
关闭时想要执行 API 函数 (_getSavingsPlanDetail
),但如果通过向下拖动则不会。
因为目前 _getSavingsPlanDetail
始终执行。
要创建模态底部表,我使用此包: https://pub.dev/packages/modal_bottom_sheet
showCupertinoModalBottomSheet(
expand: true,
context: context,
backgroundColor: ColorPalettes.white,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(10),
topRight: Radius.circular(10),
),
),
isDismissible: true,
builder: (rootContext) => ManageSavingsPlanSheet(
argument: ManageSelectArgument(
iban: widget.argument.iban,
cashBalance: widget.argument.cashBalance,
digitalDepotAccountId: widget.argument.digitalDepotAccountId,
withdrawBalance: widget.argument.withdrawBalance,
canWithdraw: widget.argument.canWithdraw,
isPaused: widget.argument.isPaused,
),
),
).then((_) => _getSavingsPlanDetail(context));
Can we check the modal bottom sheet is closed by drag down or by Navigator.pop
?
Because I have a condition when the modal is closed by Navigator.pop
want to execute API function (_getSavingsPlanDetail
), but if by drag down is not.
Because for now the _getSavingsPlanDetail
is always executed.
To create a modal bottom sheet, I use this package: https://pub.dev/packages/modal_bottom_sheet
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你可以这样尝试
you can try in this way