- Flutter Scaffold.of() called wit
- Flutter学习之:SnackBar弹窗不显示问题
- RN - npm ERR! cb() never called!
- Python中的TypeError: unbound metho
- Flutter showSnackBar called on n
- Flutter报setState() or markNeedsB
- Flutter中setState导致的内存泄漏——setStat
- flutter The method '>' was calle
- 讯飞语音 JNI NewGlobalRef called wit
- flutter开发之使用setState刷新页面 内存溢出
添加Drawer 抽屉效果
Scaffold.of(context).openDrawer();
报错
Another exception was thrown: Scaffold.of() called with a context that does not contain a Scaffold.
1.声明
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey();
- 在Scaffold添加key
@override
Widget build(BuildContext context) {
return Scaffold(
key: _scaffoldKey,
)}
3.用_scaffoldKey 调用Drawer
_scaffoldKey.currentState!.openEndDrawer();
网友评论