老师,运行您的demo这个拍照App这个函数showModalBottomSheet就报错

来源:6-16 拍照APP开发-图片获取与图片展示【实战尝鲜】

慕运维5966064

2022-06-11

The following assertion was thrown while handling a gesture:
No MediaQuery widget ancestor found.

PhotoApp widgets require a MediaQuery widget ancestor.
The specific widget that could not find a MediaQuery ancestor was: PhotoApp
state: _PhotoAppState#b0ee5
The ownership chain for the affected widget is: “PhotoApp ← [root]”

No MediaQuery ancestor could be found starting from the context that was passed to MediaQuery.of(). This can happen because you have not added a WidgetsApp, CupertinoApp, or MaterialApp widget (those widgets introduce a MediaQuery), or it can happen if the context you use comes from a widget above those widgets.

写回答

1回答

CrazyCodeBoy

2022-06-11

在报错的页面的外层包一个MaterialApp应该能解决这个问题

0
0

Flutter从入门到进阶 实战携程网App 一网打尽核心技术

解锁Flutter开发新姿势,,系统掌握Flutter开发核心技术。

4788 学习 · 3277 问题

查看课程