老师,运行您的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应该能解决这个问题
00
相似问题