-
Notifications
You must be signed in to change notification settings - Fork 29.2k
Add Scaffold drawers escape dismiss action. #106186
New issue
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
Add Scaffold drawers escape dismiss action. #106186
Conversation
Scaffold.drawer
/Scaffold.endDrawer
escape dismiss actionvoid invoke(DismissIntent intent) { | ||
Scaffold.of(context).closeDrawer(); | ||
Scaffold.of(context).closeEndDrawer(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is added unconditionally since these functions already check if there is a drawer and if it is open.
flutter/packages/flutter/lib/src/material/scaffold.dart
Lines 2156 to 2160 in 526c33f
void closeDrawer() { | |
if (hasDrawer && isDrawerOpen) { | |
_drawerKey.currentState!.close(); | |
} | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add documentation for this feature? Maybe on Scaffold.drawer and Scaffold.endDrawer, and the class Drawer?
@@ -70,17 +71,17 @@ void main() { | |||
|
|||
scaffoldState.openDrawer(); | |||
await tester.pumpAndSettle(); | |||
expect(true, isDrawerOpen); | |||
expect(isDrawerOpen, true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for cleaning these up!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent! Thank you for being so thorough!
251b359
to
a7aa392
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixes #106131
Pre-launch Checklist
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.