Repository navigation
[cupertino_ui] Fix CupertinoMagnifier focal point with custom size - #13029
auto-submit[bot] merged 2 commits into
Conversation
CupertinoMagnifier computed its focal point offset from kDefaultSize instead of the size it was given, so magnifiers with a custom size did not center the magnified content vertically. Fixes flutter/flutter#151740
There was a problem hiding this comment.
Code Review
This pull request updates CupertinoMagnifier to calculate its focal point offset using its actual size instead of kDefaultSize, and adds a corresponding widget test. Feedback points out that Offset is immutable, meaning the call to focalPointOffset.scale(...) does not mutate the variable and the animation scale is currently ignored. A correction is suggested to apply the scale directly during initialization.
| @override | ||
| Widget build(BuildContext context) { | ||
| var focalPointOffset = Offset(0, (kDefaultSize.height / 2) - kMagnifierAboveFocalPoint); | ||
| var focalPointOffset = Offset(0, (size.height / 2) - kMagnifierAboveFocalPoint); |
There was a problem hiding this comment.
The Offset class in Flutter is immutable. Calling focalPointOffset.scale(...) on line 357 returns a new Offset but does not mutate the existing one, meaning the animation scale is currently ignored. To fix this, you can apply the scale directly during the initialization of focalPointOffset on this line, and then remove the redundant focalPointOffset.scale(...) call on line 357.
var focalPointOffset = Offset(0, ((size.height / 2) - kMagnifierAboveFocalPoint) * (inOutAnimation?.value ?? 1));There was a problem hiding this comment.
Could you take a look at this comment from Gemini? It seems to be an existing issue, so I'm not sure if we should fix it here or create a separate issue for it.
There was a problem hiding this comment.
Thanks for pointing it out! You're right, scale is a no-op because Offset is immutable, but it was already like that before this PR. Fixing it would change the in/out animation of every CupertinoMagnifier, not only custom sizes, so I think it's better handled in a separate issue. I'm happy to open one and work on it.
…er#193840) flutter/packages@5620e65...951f2f7 2026-10-05 [email protected] [material_ui] Add scrollPadding property to DropdownMenuFormField (flutter/packages#12735) 2026-10-02 [email protected] [material_ui] Migrate M3 Motion template to use new gen_defaults (flutter/packages#13058) 2026-10-02 [email protected] [cupertino_ui] Forward showDragHandle from showCupertinoSheet to CupertinoSheetRoute (flutter/packages#13011) 2026-10-02 [email protected] [cupertino_ui] Fix CupertinoMagnifier focal point with custom size (flutter/packages#13029) 2026-10-02 [email protected] [ci] Add material_ui and cupertino_ui to customer testing (flutter/packages#13114) 2026-10-02 [email protected] [material_ui] Add Material 3 Expressive migration skill (flutter/packages#12818) 2026-10-02 [email protected] [video_player] Ignore late position updates after disposal (flutter/packages#12971) 2026-10-02 [email protected] [material_ui] Remove unconditional dart:io import from about.dart (flutter/packages#12774) 2026-10-02 [email protected] [material_ui] Fix DropdownButtonFormField underline alignment at bottom (flutter/packages#12606) 2026-10-02 [email protected] Roll Flutter from e89fd0a to d03768e (23 revisions) (flutter/packages#13111) 2026-10-02 [email protected] [material_ui] Migrate `Switch` API doc snippets to {@example} (batch 8) (flutter/packages#13052) 2026-10-02 [email protected] [url_launcher] Fix supportsCloseForLaunchMode to query close support (flutter/packages#12926) 2026-10-02 [email protected] Redistribute iOS/macOS Suggested Reviewers (flutter/packages#13076) 2026-10-02 [email protected] [image_picker] Subsample large images when resizing on Android (flutter/packages#13038) 2026-10-02 [email protected] [cupertino_ui] Remove redundant null arguments in Completer.complete (flutter/packages#13008) 2026-10-02 [email protected] [repo] Update AGENTS.md with dependency allowance and versioning guidance (flutter/packages#12579) 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
CupertinoMagnifierusedkDefaultSize.heightinstead ofsize.heightto compute its focal point, so magnified content was not vertically centered with a customsize. The default size is unchanged.Fixes flutter/flutter#151740
Pre-Review Checklist
[shared_preferences]///).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