我正在尝试CupertinoNavigationBar
使用 endDrawer 添加,我尝试在尾随上添加手势检测器,但不起作用,显示如下:
The following assertion was thrown while handling a gesture:
flutter: `Scaffold.of()` called with a context that does not contain a Scaffold.
flutter: No Scaffold ancestor could be found starting from the context that was passed to `Scaffold.of()`. This
flutter: usually happens when the context provided is from the same StatefulWidget as that whose build
我已经尝试将密钥添加到脚手架并尝试使用密钥打开,我也尝试使用 appbar 中的脚手架上下文
应用栏:
Scaffold(
appBar: CupertinoNavigationBar(
transitionBetweenRoutes: true,
trailing: IconButton(
icon: Icon(Icons.menu),
onPressed: () {
Scaffold.of(context).openEndDrawer();
},),
actionsForegroundColor: Colors.white,
middle: Text('Lejour', style: TextStyle(color: Colors.white)),
backgroundColor: Theme.of(context).primaryColor),
endDrawer: DrawerMenu() // my own class,
body: // ...body
我希望 CupertinoNavigationBar 的尾随图标打开 endDrawer
Scaffold.of(context).openEndDrawer();