Repository navigation
[cupertino_ui] Fix CupertinoNavigationBarBackButton assertion debug - #13397
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
There was a problem hiding this comment.
Code Review
This pull request updates the assertion in CupertinoNavigationBarBackButton to allow it to be built during a navigation bar transition by checking for a _NavigationBarTransition ancestor widget. It also adds a widget test to verify this behavior and includes a changelog entry. There are no review comments, and I have no feedback to provide.
…nav bar transition
928ee85 to
d1f6ce3
Compare
dkwingsmt
left a comment
There was a problem hiding this comment.
LGTM. Thank you for the fix!
theprantadutta
left a comment
There was a problem hiding this comment.
I tested the fix in both directions, and it works as expected. The new regression test covers pushing a page, but I also verified that popping back during the transition triggers the same assertion without the fix and passes with it.
Would it be worth adding a regression test for the pop direction as well, so both cases are covered?
|
@theprantadutta Thank you very much for verifying it! Testing pop would be a valuable add if @mahaamimran has the opportunity. |
|
Thanks @theprantadutta for testing both directions, and @dkwingsmt for the review! Good call. I’ll add a regression test for the pop direction and push it shortly. |
|
The pop-direction test is now pushed (695abe4). It fails with the same assertion without the fix and passes with it. @dkwingsmt could you take another look when you have a chance? Thanks! |
…er#197056) flutter/packages@81b7c44...898818d 2026-11-20 [email protected] [material_ui] Use correct time format for Sinhala locale (flutter/packages#13645) 2026-11-20 [email protected] [material_ui] Fix showModalBottomSheet safe area on display-feature sub-screens (flutter/packages#13428) 2026-11-20 [email protected] [material_ui] Fix M3 doc errors in the `ElevatedButton` and `FilledButton` (flutter/packages#13685) 2026-11-19 [email protected] [video_player] Convert implementation to Kotlin (flutter/packages#13683) 2026-11-19 [email protected] [flutter_svg] Add SvgLoader.provideSvgInIsolate for unsendable loaders (flutter/packages#13598) 2026-11-19 [email protected] [VPAT] Expose modal drawers with the dialog semantics role (flutter/packages#13660) 2026-11-19 [email protected] [VPAT] Keep a11y_assessments tooltips open while hovered (flutter/packages#13657) 2026-11-19 [email protected] [flutter_svg] Stabilize network SVG cache keys (flutter/packages#13597) 2026-11-19 [email protected] [image_picker_ios] Return an error instead of an empty file when an image cannot be saved (flutter/packages#12998) 2026-11-19 [email protected] [cupertino_ui] Fix CupertinoNavigationBarBackButton assertion debug (flutter/packages#13397) 2026-11-19 [email protected] [go_router] Document when GoRouterState.name and path are null (flutter/packages#13486) If this roll has caused a breakage, revert this CL and set the roller to dry run mode using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC [email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Fixes the debug assertion thrown by
CupertinoNavigationBarBackButtonwhen it is passed manually as aCupertinoNavigationBar'sleadingwidget and a page is pushed.During the push, the navigation bar transition builds another copy of the
leadingwidget in the Navigator's overlay, outside of any route. ThereModalRoute.of(context)is null, socurrentRoute?.canPop ?? falsewas false and the assertion failed. The assertion will also now pass when the widget has a_NavigationBarTransitionancestor. It still fires outside any route and in a route that cannot be popped.Fixes flutter/flutter#89888
Validation
flutter analyze(no issues)dart format(no changes)flutter testinpackages/cupertino_ui(all passing)nav_bar_test.dartfails without the change and passes with it.cupertino_uiuses batch release, so this adds apending_changelogsentry instead of editingCHANGELOG.mdorpubspec.yaml.Before and after
The new test, run on
mainwithout the change and then with it:Before (fails)
After (passes)
Pre-Review Checklist
[shared_preferences]///).If you need help, consider asking for advice on the #hackers-new channel on Discord.
Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the
gemini-code-assistbot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.Footnotes
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