dart 在Flutter中创建自定义弹出窗口

lsmepo6l  于 2023-07-31  发布在  Flutter
关注(0)|答案(1)|浏览(216)

有没有可能用Flutter创建一个在点击按钮时打开的组件,比如一个弹出窗口,但仍然能够使用已经打开的背景页面?
另一种可能性是调整组件的大小。

mnemlml8

mnemlml81#

当然,你可以使用常规对话框来获得所需的结果。只需在onTap/onPressed回调函数中添加这些行即可

  1. showGeneralDialog(
  2. context: context,
  3. pageBuilder: (context, anim1, anim2) =>
  4. const SizedBox(height: 0.0, width: 0.0),
  5. transitionBuilder: (context, animation, secAnimation, child) {
  6. return Dialog(child: CUSTOMWIDGET(), );
  7. },
  8. barrierDismissible: true,
  9. barrierLabel: 'dialog',
  10. );

字符串
其中CUSTOMWIDGET是要在单击时显示的小部件

展开查看全部

相关问题