Skip to content

Conversation

TahaTesser
Copy link
Member

fixes #106131

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@flutter-dashboard flutter-dashboard bot added f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels. labels Jun 17, 2022
@TahaTesser TahaTesser changed the title Add Scaffold.drawer/Scaffold.endDrawer escape dismiss action Add Scaffold drawers escape dismiss action. Jun 17, 2022
@TahaTesser TahaTesser requested a review from Piinks June 17, 2022 10:16
void invoke(DismissIntent intent) {
Scaffold.of(context).closeDrawer();
Scaffold.of(context).closeEndDrawer();
}
Copy link
Member Author

@TahaTesser TahaTesser Jun 17, 2022

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.

void closeDrawer() {
if (hasDrawer && isDrawerOpen) {
_drawerKey.currentState!.close();
}
}

Copy link
Contributor

@Piinks Piinks left a 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);
Copy link
Contributor

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!

Copy link
Member Author

@TahaTesser TahaTesser Jun 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, updated docs.

I took this solution from #59310 and it didn't document this behavior as a result I've filed #106650 to document the same dismiss action behavior for PopupRoute /ModalRoute and some official examples and code snippets. As these widgets need proper documentation too.

Copy link
Contributor

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!

@TahaTesser TahaTesser force-pushed the add_drawer_dismiss_action branch from 251b359 to a7aa392 Compare June 27, 2022 08:36
@TahaTesser TahaTesser requested a review from Piinks June 27, 2022 11:44
Copy link
Contributor

@Piinks Piinks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flutter_LGTM

@TahaTesser TahaTesser added the autosubmit Merge PR when tree becomes green via auto submit App label Jun 29, 2022
@auto-submit auto-submit bot merged commit 8fe82bb into flutter:master Jun 29, 2022
@TahaTesser TahaTesser deleted the add_drawer_dismiss_action branch June 29, 2022 07:25
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Jun 29, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 29, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 29, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 29, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 29, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 29, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit Merge PR when tree becomes green via auto submit App f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Scaffold drawers missing DismissAction binding
2 participants