Skip to content

[material_ui] Fix predictive back transition during CupertinoSheet drag - #12705

Open
huahua8893 wants to merge 1 commit into
flutter:mainfrom
huahua8893:predictive-back-sheet-corner
Open

[material_ui] Fix predictive back transition during CupertinoSheet drag#12705
huahua8893 wants to merge 1 commit into
flutter:mainfrom
huahua8893:predictive-back-sheet-corner

Conversation

@huahua8893

Copy link
Copy Markdown
Contributor

Ports flutter/flutter#187494 to material_ui following flutter/flutter#188444.

Fixes flutter/flutter#187492.

This PR fixes an issue where a route covered by a CupertinoSheet could incorrectly enter the predictive back transition during an unrelated navigator gesture, causing its corners to snap to the display corner radius while the sheet was being dragged.

PredictiveBackPageTransitionsBuilder and PredictiveBackFullscreenPageTransitionsBuilder previously used route.popGestureInProgress to determine whether to show the predictive back transition. However, this value is derived from navigator.userGestureInProgress, which becomes true for any navigator user gesture, including dragging a CupertinoSheet above the route.

The resulting corner jump is visible on physical Android devices that report display corner radii. When no display corner radius is reported, the fallback value of BorderRadius.zero masks the visual symptom. The issue does not occur on iOS because it uses CupertinoPageTransitionsBuilder.

This change uses the predictive back phase instead, so a covered route only enters the predictive back transition during an actual system back gesture. It also adds regression coverage for both predictive back transition builders.

Tests

  • flutter test test/predictive_back_page_transitions_builder_test.dart --no-pub
  • dart run script/tool/bin/flutter_plugin_tools.dart analyze --packages material_ui
  • dart run script/tool/bin/flutter_plugin_tools.dart validate --packages material_ui --base-sha=9854cd5607da4001f2dd3cbdcd6903202d28958c --check-for-missing-changes
  • dart run script/tool/bin/flutter_plugin_tools.dart publish-check --packages material_ui

Pre-Review Checklist

Footnotes

  1. Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. 2

…ged CupertinoSheet

PredictiveBackPageTransitionsBuilder and PredictiveBackFullscreenPageTransitionsBuilder chose whether to show the predictive back transition based on route.popGestureInProgress, which is navigator.userGestureInProgress -- true for any user gesture anywhere in the navigator, including dragging a CupertinoSheet that covers the route. That made the covered route incorrectly switch to the predictive back transition while an unrelated sheet was being dragged.

Gate on the predictive back phase instead, which is only non-idle while an actual predictive back gesture is in progress.
@github-actions github-actions Bot added p: material_ui triage-design Should be looked at in design triage labels Aug 31, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request updates PredictiveBackPageTransitionsBuilder and PredictiveBackFullscreenPageTransitionsBuilder to use the predictive back transition only when the transition phase is not idle, replacing the previous check on route.popGestureInProgress. This change prevents a covered route from initiating a predictive back transition while a CupertinoSheet is being dragged. A new widget test has been added to verify this behavior, along with a pending changelog entry. There are no review comments, and I have no feedback to provide.

@huahua8893

Copy link
Copy Markdown
Contributor Author

@dkwingsmt @justinmc This is the migrated PR from flutter/flutter#187494. Could you please review the change here? Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

p: material_ui triage-design Should be looked at in design triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Covered route's corners snap to the display corner radius when dragging a CupertinoSheet

1 participant