[英]Close the Drawer on Tap ListTile
Want that onTap ListTile of Drawer,drawer closed.想要那个 onTap ListTile 的 Drawer,抽屉关闭。
I have used Navigation.pop(context) but it pop whole screen.我使用了 Navigation.pop(context) 但它会弹出整个屏幕。 I have a CustomScaffold with global key.
我有一个带有全局键的 CustomScaffold。
You can put this code in any onpressed event and you will get a solution.您可以将此代码放在任何按下的事件中,您将获得解决方案。
onPressed: () {
if (_scaffoldKey.currentState.isDrawerOpen)
_scaffoldKey.currentState.openEndDrawer();
else {
_scaffoldKey.currentState.openDrawer();
}
},
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.