Skip to content

Fix Scaffold setState during locked framework due to open drawer - #107173

Merged
auto-submit[bot] merged 1 commit into
flutter:masterfrom
NevercodeHQ:drawer-orientation-fix
Jul 18, 2022
Merged

auto-submit[bot] merged 1 commit into
flutter:masterfrom
NevercodeHQ:drawer-orientation-fix

Conversation

@markusaksli-nc

Copy link
Copy Markdown
Contributor

When the drawer is open and gets disposed during locked framework it still removes its controller history entry in dispose, leading to a setState response in Scaffold to close the drawer. This led to an exception and a broken BackButton in the AppBar in certain situations.

This PR adds a check before the drawer and endDrawer opened callback setState to ensure that the drawer state still exists to avoid the issue. I considered adding it to a post-frame callback but it runs into the issue of the scaffold being disposed along with the drawer and then triggering setState for a disposed state.

Fixes #34978

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.

@flutter-dashboard flutter-dashboard Bot added p: material_ui material_ui package in flutter/packages framework flutter/packages/flutter repository. See also f: labels. labels Jul 6, 2022
@markusaksli-nc
markusaksli-nc force-pushed the drawer-orientation-fix branch from 013c27a to 7fc4719 Compare July 6, 2022 17:24
Comment thread packages/flutter/lib/src/material/scaffold.dart Outdated
Comment thread packages/flutter/lib/src/material/scaffold.dart Outdated
Comment thread packages/flutter/test/material/drawer_test.dart Outdated
Comment thread packages/flutter/test/material/drawer_test.dart Outdated
Comment thread packages/flutter/test/material/drawer_test.dart Outdated
Comment thread packages/flutter/test/material/drawer_test.dart Outdated
@markusaksli-nc
markusaksli-nc force-pushed the drawer-orientation-fix branch from 7fc4719 to 5cf29c5 Compare July 11, 2022 17:18

@goderbauer goderbauer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@markusaksli-nc
markusaksli-nc force-pushed the drawer-orientation-fix branch from 5cf29c5 to 2708571 Compare July 18, 2022 09:39
@markusaksli-nc markusaksli-nc added the autosubmit Merge PR when tree becomes green via auto submit App label Jul 18, 2022
@auto-submit
auto-submit Bot merged commit da3b2a2 into flutter:master Jul 18, 2022
@markusaksli-nc
markusaksli-nc deleted the drawer-orientation-fix branch July 18, 2022 11:52
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Jul 19, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 19, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 19, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 19, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 19, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 19, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 19, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 19, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 22, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 22, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 22, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 22, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 22, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Jul 22, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 23, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 23, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 24, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 24, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 25, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 25, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 25, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 25, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 25, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 25, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 25, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 25, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 25, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 25, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 25, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 25, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 26, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 26, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 26, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 26, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 26, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 26, 2022
camsim99 pushed a commit to camsim99/flutter that referenced this pull request Aug 10, 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 framework flutter/packages/flutter repository. See also f: labels. p: material_ui material_ui package in flutter/packages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

When drawer is open, going to landscape orientation causes the the drawer to close and back button appears instead

2 participants