问题:Flutter今天添加Drawer遇到了错误
Scaffold.of() called with a context that does not contain a Scaffold.
原因 :BuildContext在Scaffold之前,调用Scaffold.of(context)会报错
解决方案
Builder(
builder: (BuildContext context) {
// 这里Container可以换成想要的Widget
return Container();
},
)