Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Comments

[CP-stable] fixes a status bar tap crash#182691

Draft
LongCatIsLooong wants to merge 4 commits intoflutter:flutter-3.41-candidate.0from
LongCatIsLooong:reland-179643-stable
Draft

[CP-stable] fixes a status bar tap crash#182691
LongCatIsLooong wants to merge 4 commits intoflutter:flutter-3.41-candidate.0from
LongCatIsLooong:reland-179643-stable

Conversation

@LongCatIsLooong
Copy link
Contributor

@LongCatIsLooongLongCatIsLooong commentedFeb 20, 2026
edited
Loading

This pull request is manually created because there were merge conflicts.

Click here for the conflicts
diff --cc packages/flutter/test/widgets/interactive_viewer_test.dartindex e4ef3492f0d,63b1c353d72..00000000000--- a/packages/flutter/test/widgets/interactive_viewer_test.dart+++ b/packages/flutter/test/widgets/interactive_viewer_test.dart@@@ -1044,25 -956,22 +1044,43 @@@ void main()           var calledStart = false;          var calledUpdate = false;          var calledEnd = false;+         const sizedBox = SizedBox(width: 200.0, height: 200.0);          await tester.pumpWidget(++<<<<<<< HEAD +          MaterialApp( +            home: Scaffold( +              body: Center( +                child: InteractiveViewer( +                  transformationController: transformationController, +                  scaleEnabled: false, +                  onInteractionStart: (ScaleStartDetails details) { +                    calledStart = true; +                  }, +                  onInteractionUpdate: (ScaleUpdateDetails details) { +                    calledUpdate = true; +                  }, +                  onInteractionEnd: (ScaleEndDetails details) { +                    calledEnd = true; +                  }, +                  child: const SizedBox(width: 200.0, height: 200.0), +                ), +              ),++=======+           Center(+             child: InteractiveViewer(+               transformationController: transformationController,+               scaleEnabled: false,+               onInteractionStart: (ScaleStartDetails details) {+                 calledStart = true;+               },+               onInteractionUpdate: (ScaleUpdateDetails details) {+                 calledUpdate = true;+               },+               onInteractionEnd: (ScaleEndDetails details) {+                 calledEnd = true;+               },+               child: sizedBox,++>>>>>>> 91b2d41a66d (Reland #179643, only scroll hit-testable primary scroll views on status bar tap (#182391))              ),            ),          );@@@ -1119,25 -1028,22 +1137,43 @@@          var calledStart = false;          var calledUpdate = false;          var calledEnd = false;+         const sizedBox = SizedBox(width: 200.0, height: 200.0);          await tester.pumpWidget(++<<<<<<< HEAD +          MaterialApp( +            home: Scaffold( +              body: Center( +                child: InteractiveViewer( +                  transformationController: transformationController, +                  scaleEnabled: false, +                  onInteractionStart: (ScaleStartDetails details) { +                    calledStart = true; +                  }, +                  onInteractionUpdate: (ScaleUpdateDetails details) { +                    calledUpdate = true; +                  }, +                  onInteractionEnd: (ScaleEndDetails details) { +                    calledEnd = true; +                  }, +                  child: const SizedBox(width: 200.0, height: 200.0), +                ), +              ),++=======+           Center(+             child: InteractiveViewer(+               transformationController: transformationController,+               scaleEnabled: false,+               onInteractionStart: (ScaleStartDetails details) {+                 calledStart = true;+               },+               onInteractionUpdate: (ScaleUpdateDetails details) {+                 calledUpdate = true;+               },+               onInteractionEnd: (ScaleEndDetails details) {+                 calledEnd = true;+               },+               child: sizedBox,++>>>>>>> 91b2d41a66d (Reland #179643, only scroll hit-testable primary scroll views on status bar tap (#182391))              ),            ),          );

Issue Link:

What is the link to the issue this cherry-pick is addressing?

#182233
The bug was introduced in#179643 which was cherry picked to 3.41 beta (so the fix should exist on both current beta and stable).

Impact Description:

On iOS, the app may crash when the user taps on the status bar to scroll to top, when the app has a primary scroll view that has never been laid out (for example, in a route that has been obstructed by other routes).

Changelog Description:

  • flutter/182233 - Tapping on the status bar may crash the app on iOS when there's a primary scroll view that has never been laid out.

Additionally this patch only dispatches the "scroll to top" command to the topmost Scaffold which is generally better UX for most apps (this doesn't have to be in the changlog)

Workaround:

No known easy workarounds.

Risk:

What is the risk level of this cherry-pick?

  • Low
  • Medium
  • High

Test Coverage:

Are you confident that your fix is well-tested by automated tests?

  • Yes
  • No

Validation Steps:

What are the steps to validate that this fix works?

I've manually tested the fix on iOS/iPadOS simulators. There are also unit tests.

MinSeungHyun reacted with eyes emoji
…on status bar tap (flutter#182391)Relandflutter#179643, with[changes](flutter@3f7d345)tofixflutter#182233. The relandclosesflutter#177992,closesflutter#175606.The crash happened because `Scaffold.handleStatusBar` (and subsequently`ScrollController.animateTo`) is called on a scaffold that [has neverbeen laidout](flutter#182233 (comment)).Beforeflutter#179643, the iOS embedder sends a fake touch down pointer eventat `(0, 0)` to the framework, followed by a touch up pointer event atthe same location. That ensured only the foreground `Scaffold` couldclaim the tap gesture and handle the status bar tap.The fix tries to restore the previous behavior (where the iOS behaviorsends fake touches instead of platform messages) by performing ahit-test at `(0, 0)` before trying to scroll the primary controller of a`Scaffold` to the top, this should make sure that only the foregroundscaffold (in theory it's still possible for more than one Scaffold toreceive the hittest and handle the status bar tap event, but theforeground scaffold should block the hit-test on background ones insteadof relying on gesture disambiguation).- [ ] I read the [Contributor Guide] and followed the process outlinedthere for submitting PRs.- [ ] I read the [Tree Hygiene] wiki page, which explains myresponsibilities.- [ ] I read and followed the [Flutter Style Guide], including [Featureswe expect every widget to implement].- [ ] I signed the [CLA].- [ ] I listed at least one issue that this PR fixes in the descriptionabove.- [ ] 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].- [ ] I followed the [breaking change policy] and added [Data DrivenFixes] where supported.- [ ] All existing and new tests are passing.If you need help, consider asking for advice on the #hackers-new channelon [Discord].**Note**: The Flutter team is currently trialing the use of [Gemini CodeAssist forGitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code).Comments from the `gemini-code-assist` bot should not be taken asauthoritative feedback from the Flutter team. If you find its commentsuseful you can update your code accordingly, but if you are unsure ordisagree with the feedback, please feel free to wait for a Flutter teammember's review for guidance on which automated comments should beaddressed.<!-- Links -->[Contributor Guide]:https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview[Tree Hygiene]:https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md[test-exempt]:https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests[Flutter Style Guide]:https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md[Features we expect every widget to implement]:https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement[CLA]:https://cla.developers.google.com/[flutter/tests]:https://github.com/flutter/tests[breaking change policy]:https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes[Discord]:https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md[Data Driven Fixes]:https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
@flutter-dashboard
Copy link

This pull request was opened from and to a release candidate branch. This should only be done as part of the officialFlutter release process. If you are attempting to make a regular contribution to the Flutter project, please close this PR and follow the instructions atTree Hygiene for detailed instructions on contributing to Flutter.

Reviewers: Use caution before merging pull requests to release branches. Ensure the proper procedure has been followed.

@github-actionsgithub-actionsbot added a: tests"flutter test", flutter_test, or one of our tests frameworkflutter/packages/flutter repository. See also f: labels. f: material designflutter/packages/flutter/material repository. f: cupertinoflutter/packages/flutter/cupertino repository labelsFeb 20, 2026
Copy link
Contributor

@gemini-code-assistgemini-code-assistbot left a comment

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 addresses a crash on iOS when tapping the status bar by ensuring only the topmost, hit-testable scaffold responds to the tap. This also improves the user experience for apps with multiple nested scaffolds. The implementation correctly uses a hit-testable widget in the status bar area to determine if a scaffold is in the foreground. The test changes are good, with a newsimulateStatusBarTap helper and tests covering the new behavior. My main feedback is on code duplication: the_HitTestableAtOrigin helper class is duplicated in bothmaterial/scaffold.dart andcupertino/page_scaffold.dart. This should be refactored into a shared utility to improve maintainability.

Comment on lines +3483 to +3519
finalclass_HitTestableAtOriginextendsStatelessWidget {
const_HitTestableAtOrigin(this.globalKey);

finalGlobalKey globalKey;

/// Whether the render box of the[_HitTestableAtOrigin] widget associated
/// with the given global`key` is hit-testable at[Offset.zero].
///
/// This is used by the`handleStatusBarTap` implementation to avoid sending
/// status bar tap events to scroll views in offscreen subtrees.
staticboolhitTestableAtOrigin(GlobalKey key) {
final context= key.currentContextasElement?;
if (context==null) {
assert(
false,
'BuildContext associated with $key is not mounted. '
'If you see this in a test, this is likely because the test was trying '
'to simulate status bar tap on a non-iOS platform',
);
returnfalse;
}
final renderObject= context.renderObject!asRenderMetaData;
finalint viewId=View.of(context).viewId;
final result=HitTestResult();
WidgetsBinding.instance.hitTestInView(result,Offset.zero, viewId);
return result.path.any((HitTestEntry entry)=> entry.target== renderObject);
}

@override
Widgetbuild(BuildContext context) {
returnMetaData(
key: globalKey,
behavior:HitTestBehavior.translucent,
child:constSizedBox.expand(),
);
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The_HitTestableAtOrigin class is nearly identical to the one inpackages/flutter/lib/src/cupertino/page_scaffold.dart. Duplicating code like this makes maintenance harder and violates the DRY (Don't Repeat Yourself) principle.

To improve maintainability, this class should be extracted to a shared location (e.g., a new file underlib/src/widgets/) and made public. The slightly differentassert messages in the two versions can be merged into a single, more descriptive one.

References
  1. The style guide advises to 'Avoid duplicating state', which by extension applies to code logic as well to maintain a single source of truth and improve maintainability.(link)

@LongCatIsLooongLongCatIsLooong marked this pull request as draftFebruary 20, 2026 23:19
…9643)" (flutter#182223)This reverts commitf4c83de.See b/482565401.## Pre-launch Checklist- [x] I read the [Contributor Guide] and followed the process outlinedthere for submitting PRs.- [x] I read the [Tree Hygiene] wiki page, which explains myresponsibilities.- [x] I read and followed the [Flutter Style Guide], including [Featureswe expect every widget to implement].- [x] I signed the [CLA].- [x] I listed at least one issue that this PR fixes in the descriptionabove.- [x] I updated/added relevant documentation (doc comments with `///`).- [x] I added new tests to check the change I am making, or this PR is[test-exempt].- [x] I followed the [breaking change policy] and added [Data DrivenFixes] where supported.- [x] All existing and new tests are passing.If you need help, consider asking for advice on the #hackers-new channelon [Discord].**Note**: The Flutter team is currently trialing the use of [Gemini CodeAssist forGitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code).Comments from the `gemini-code-assist` bot should not be taken asauthoritative feedback from the Flutter team. If you find its commentsuseful you can update your code accordingly, but if you are unsure ordisagree with the feedback, please feel free to wait for a Flutter teammember's review for guidance on which automated comments should beaddressed.<!-- Links -->[Contributor Guide]:https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview[Tree Hygiene]:https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md[test-exempt]:https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests[Flutter Style Guide]:https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md[Features we expect every widget to implement]:https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement[CLA]:https://cla.developers.google.com/[flutter/tests]:https://github.com/flutter/tests[breaking change policy]:https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes[Discord]:https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md[Data Driven Fixes]:https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
…on status bar tap (flutter#182391)Relandflutter#179643, with[changes](flutter@3f7d345)tofixflutter#182233. The relandclosesflutter#177992,closesflutter#175606.The crash happened because `Scaffold.handleStatusBar` (and subsequently`ScrollController.animateTo`) is called on a scaffold that [has neverbeen laidout](flutter#182233 (comment)).Beforeflutter#179643, the iOS embedder sends a fake touch down pointer eventat `(0, 0)` to the framework, followed by a touch up pointer event atthe same location. That ensured only the foreground `Scaffold` couldclaim the tap gesture and handle the status bar tap.The fix tries to restore the previous behavior (where the iOS behaviorsends fake touches instead of platform messages) by performing ahit-test at `(0, 0)` before trying to scroll the primary controller of a`Scaffold` to the top, this should make sure that only the foregroundscaffold (in theory it's still possible for more than one Scaffold toreceive the hittest and handle the status bar tap event, but theforeground scaffold should block the hit-test on background ones insteadof relying on gesture disambiguation).- [ ] I read the [Contributor Guide] and followed the process outlinedthere for submitting PRs.- [ ] I read the [Tree Hygiene] wiki page, which explains myresponsibilities.- [ ] I read and followed the [Flutter Style Guide], including [Featureswe expect every widget to implement].- [ ] I signed the [CLA].- [ ] I listed at least one issue that this PR fixes in the descriptionabove.- [ ] 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].- [ ] I followed the [breaking change policy] and added [Data DrivenFixes] where supported.- [ ] All existing and new tests are passing.If you need help, consider asking for advice on the #hackers-new channelon [Discord].**Note**: The Flutter team is currently trialing the use of [Gemini CodeAssist forGitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code).Comments from the `gemini-code-assist` bot should not be taken asauthoritative feedback from the Flutter team. If you find its commentsuseful you can update your code accordingly, but if you are unsure ordisagree with the feedback, please feel free to wait for a Flutter teammember's review for guidance on which automated comments should beaddressed.<!-- Links -->[Contributor Guide]:https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview[Tree Hygiene]:https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md[test-exempt]:https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests[Flutter Style Guide]:https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md[Features we expect every widget to implement]:https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement[CLA]:https://cla.developers.google.com/[flutter/tests]:https://github.com/flutter/tests[breaking change policy]:https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes[Discord]:https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md[Data Driven Fixes]:https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

1 more reviewer

@gemini-code-assistgemini-code-assist[bot]gemini-code-assist[bot] left review comments

Reviewers whose approvals may not affect merge requirements

At least 1 approving review is required to merge this pull request.

Assignees

No one assigned

Labels

a: tests"flutter test", flutter_test, or one of our testsf: cupertinoflutter/packages/flutter/cupertino repositoryf: material designflutter/packages/flutter/material repository.frameworkflutter/packages/flutter repository. See also f: labels.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@LongCatIsLooong@vashworth

[8]ページ先頭

©2009-2026 Movatter.jp