flutter - flutter 是如何让 PopupRoute 不覆盖 appbar 的?
问题描述
使用PopopRoute弹出的图片中的白块。我需要通过点击appbar来关闭这个popop。但是我发现appbar似乎被覆盖了,我点击它并没有事件响应。
void showTop() {
// Get the coordinates of the click control
final RenderBox button = _buttonKey.currentContext.findRenderObject();
final RenderBox overlay = Overlay.of(context).context.findRenderObject();
// Get the coordinates of the bottom left of the control
var a = button.localToGlobal(Offset(0.0, button.size.height),
ancestor: overlay);
// Get the coordinates of the bottom right of the control
var b = button.localToGlobal(button.size.bottomLeft(Offset(0, 0)),
ancestor: overlay);
final RelativeRect position = RelativeRect.fromRect(
Rect.fromPoints(a, b),
Offset.zero & overlay.size,
);
final RenderBox body = _bodyKey.currentContext.findRenderObject();
showPopupWindow(
context: context,
fullWidth: true,
position: position,
elevation: 3.0,
child: GestureDetector(
onTap: () {
NavigatorUtils.goBack(context);
setState(() {
isShow = false;
});
},
child: Container(
// color: const Color(0x99000000),
height: body.size.height,
child: Container(
alignment: Alignment.center,
height: double.infinity,
color: Colors.white10,
child: Text("Im Test?"),
),
),
),
);
}
因为showPopupWindow代码太长,我单独做了个链接展示一下
解决方案
推荐阅读
- google-chrome-extension - 将扩展迁移到清单 v3
- amazon-ecs - 如何使用 ECR 编辑 Caddyfile
- python - 为什么是我的鼠标射击而不是我的播放器?
- r - 使用 R 和 Rvest 抓取网页时出现问题
- reactjs - 在 github 页面上部署 react 应用程序时,我遇到了错误-请确保您具有正确的访问权限并且存储库存在
- applescript - 有没有办法将变量存储在 Applescript 库中?
- swift - VC中动态改变背景颜色
- javascript - 谷歌日历 API 路径
- python - 如何通过 Python 中的 Seaborn 库绘制多线图?
- c# - 在运行时表单子表单关闭方法中不起作用