We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
https://docs.flutter.dev/cookbook/design/drawer/
https://github.com/flutter/website/tree/main/src/content/cookbook/design/drawer.md
没有打开 drawer 的相关说明和代码。
请添加打开 drawer 相关的代码和说明。
例如:
打开 drawer 有两种常用的操作方式。
第一种方式,在 Builder 中子组件的点击事件中打开 drawer。
Builder
drawer
Scaffold( appBar: AppBar( leading: Builder( builder: (context) { return IconButton( icon: const Icon(Icons.menu), onPressed: () { Scaffold.of(context).openDrawer(); }, ); }, ), ), drawer: Drawer(), )
第二种方式,给定一个 GlobalKey<ScaffoldState>,然后你可以使用他来打开 drawer。
GlobalKey<ScaffoldState>
final GlobalKey<ScaffoldState> scaffoldStateKey = GlobalKey<ScaffoldState>(); Scaffold( key: scaffoldStateKey, appBar: AppBar( leading: IconButton( icon: const Icon(Icons.menu), onPressed: () { scaffoldStateKey.currentState?.openDrawer(); }, ), ), drawer: Drawer(), )
No response
The text was updated successfully, but these errors were encountered:
There are no instructions or codes for opening the drawer.
Please add the code and instructions related to opening the drawer.
For example: Open drawer programmatically. There are two common operations for opening the drawer.
The first way is to open the drawer in the click event of the subcomponent in the Builder.
The second way, given a GlobalKey<ScaffoldState>, then you can use it to open the drawer.
Sorry, something went wrong.
No branches or pull requests
Page URL
https://docs.flutter.dev/cookbook/design/drawer/
Page source
https://github.com/flutter/website/tree/main/src/content/cookbook/design/drawer.md
Describe the problem
没有打开 drawer 的相关说明和代码。
Expected fix
请添加打开 drawer 相关的代码和说明。
例如:
通过编程打开 drawer
打开 drawer 有两种常用的操作方式。
第一种方式,在
Builder
中子组件的点击事件中打开drawer
。第二种方式,给定一个
GlobalKey<ScaffoldState>
,然后你可以使用他来打开drawer
。Additional context
No response
I would like to fix this problem.
The text was updated successfully, but these errors were encountered: