Repository navigation
[cupertino_ui] fix CupertinoIcons font not being included in examples and fix TextEditingController leaks - #12228
Conversation
| test: ^1.31.0 | ||
| vector_math: ^2.2.0 | ||
| web: ^1.1.1 | ||
| cupertino_icons: ^1.0.9 |
There was a problem hiding this comment.
Since the examples were relying on the Material Icons, I opted to switch to CupertinoIcons to fix those cross imports. This is also documented in the docs for cupertino_ui's CupertinoIcons class, but it was missing from the examples pubspec.
See https://github.com/flutter/packages/blob/main/packages/cupertino_ui/lib/src/icons.dart#L13-L15
There was a problem hiding this comment.
Code Review
This pull request removes material_ui imports and dependencies from the cupertino_ui package examples and tests, replacing Material widgets, icons, and colors with Cupertino equivalents. The reviewer suggests removing the unused material_ui dependency from pubspec.yaml to clean up the configuration.
| cupertino_icons: ^1.0.9 | ||
| cupertino_ui: | ||
| path: .. | ||
| material_ui: |
There was a problem hiding this comment.
This is not true, since there are @docImports of material_ui, which this PR does not fix.
| } | ||
|
|
||
| class _TextMagnifierExampleAppState extends State<TextMagnifierExampleApp> { | ||
| late final controller = TextEditingController(text: widget.text); |
There was a problem hiding this comment.
This one was not disposed :(
| const Duration durationBetweenActions = Duration(milliseconds: 20); | ||
| const String defaultText = 'I am a magnifier, fear me!'; | ||
|
|
||
| Future<void> showMagnifier(WidgetTester tester, int textOffset) async { |
There was a problem hiding this comment.
For CupertinoTextField, instead of double tapping the word, I had to use long press to make it show up.
|
I am going to move this to a draft for now since we are not ready to start taking contributions that we have not identified as critical to get to our initial release. We also do not want other contributors to mistake these packages as ready for PRs yet and flood the queue while we are focusing on the most essential work to be able to ship. This is also a more significant refactor I want to make sure we review thoroughly. :) |
|
Agreed! Yeah I just put this up so I wouldn't lose track of it. |
It might actually be ok. These are just the examples, which IIRC, do not require the package itself to take on the dependency. In general, I think it is ok to have cross imports in the examples of the package? Examples can use all sorts of other packages for demonstration, why should they be removed? |
|
@Piinks Is it time we resume reviewing this PR? (Also there are lots of conflicts) |
Up to @navaronbracke! If you want to mark this ready for review and resolve the conflicts, or open a fresh PR, let us know! |
|
I do need to clean this up a little bit first. I'll get back to you when that is done. Maybe this won't be needed if we just switch over to cupertino_ui/material_ui, but I'll see when the diff is cleaned up. |
8ea52a5 to
e74ffbd
Compare
fdcf7bb to
f8b6af9
Compare
| class _CupertinoTextMagnifierExampleAppState | ||
| extends State<CupertinoTextMagnifierExampleApp> { | ||
| final MagnifierController _controller = MagnifierController(); | ||
| final MagnifierController _magnifierController = MagnifierController(); |
There was a problem hiding this comment.
This one was not disposed
There was a problem hiding this comment.
Sorry, I'm confused. Shouldn't this be disposed (and it's not)?
There was a problem hiding this comment.
Oh, this comment should be a line lower. The MagnifierController has no dispose method, but the TextEditingController was not disposed.
There was a problem hiding this comment.
Code Review
This pull request updates the cupertino_ui package and its examples. It converts TextMagnifierExampleApp to a StatefulWidget to manage and dispose of TextEditingController instances, resolving potential memory leaks. Additionally, it adds the cupertino_icons dependency to the example's pubspec.yaml and bumps the package version to 1.0.2. Review feedback recommends making the controller field private with an explicit type in text_magnifier.0.dart and sorting the dependencies alphabetically in pubspec.yaml.
| } | ||
|
|
||
| class _TextMagnifierExampleAppState extends State<TextMagnifierExampleApp> { | ||
| late final controller = TextEditingController(text: widget.text); |
There was a problem hiding this comment.
The controller field should be private (prefixed with an underscore) since it is only used within this state class. Additionally, it is best practice to explicitly specify the type TextEditingController for class fields rather than relying on type inference.
| late final controller = TextEditingController(text: widget.text); | |
| late final TextEditingController _controller = TextEditingController(text: widget.text); |
| test: ^1.31.0 | ||
| vector_math: ^2.2.0 | ||
| web: ^1.1.1 | ||
| cupertino_icons: ^1.0.9 | ||
| cupertino_ui: | ||
| path: .. |
|
This is now ready for review. As stated before, most of the original changes are now redundant, but I did fix up two minor issues that we can still keep for this PR. |
| @@ -1,3 +1,8 @@ | |||
| ## 1.0.2 | |||
There was a problem hiding this comment.
Thanks for updating @navaronbracke! This package uses batch release, so the changelog and pubspec are not directly edited in PRs. See flutter/flutter#188444 for some guidance on how to draft a pending changelog.
b2c7568 to
e7d8844
Compare
dkwingsmt
left a comment
There was a problem hiding this comment.
LGTM. Thank you for the cleanup!
…er#191965) flutter/packages@bd3cbc1...cd4cdd0 2026-08-28 21270878+elliette@users.noreply.github.com [material_ui] Add all M3 templates and generated code to `temporarily_excluded/` before migration (flutter/packages#12661) 2026-08-28 engine-flutter-autoroll@skia.org Roll Flutter from 15d8908 to e8dca90 (58 revisions) (flutter/packages#12660) 2026-08-28 bkonyi@google.com [various] Update pigeon dev_dependency to ^27.3.2 (flutter/packages#12615) 2026-08-27 269567208+reidbaker-agent@users.noreply.github.com [camera_android_camerax] Enforce CHANGELOG backticks and add eval commit author check to pre-push-skill (flutter/packages#12624) 2026-08-27 imcusg@gmail.com [material_ui] Prevent stale async suggestions in SearchAnchor (flutter/packages#12478) 2026-08-27 bkonyi@google.com [go_router_builder] Support analyzer 14 (flutter/packages#12614) 2026-08-27 srawlins@google.com [cupertino_ui] Use super parameters in more places (flutter/packages#12459) 2026-08-27 32538273+ValentinVignal@users.noreply.github.com [material_ui] Remove no-shuffle from progress indicator test (flutter/packages#12505) 2026-08-27 32538273+ValentinVignal@users.noreply.github.com [two_dimensional_scrollables] Activate leak testing and fix memory leaks (flutter/packages#11653) 2026-08-27 21270878+elliette@users.noreply.github.com [material_ui] Add helper methods in gen_defaults template (flutter/packages#12637) 2026-08-27 brackenavaron@gmail.com [cupertino_ui] fix CupertinoIcons font not being included in examples and fix TextEditingController leaks (flutter/packages#12228) 2026-08-27 269567208+reidbaker-agent@users.noreply.github.com [camera_android_camerax] Check Git hooks configuration in check-readiness skill (flutter/packages#12628) 2026-08-27 47866232+chunhtai@users.noreply.github.com [ci] sync back pr for branch release only run when release succeeds (flutter/packages#12581) 2026-08-27 stuartmorgan@google.com [google_maps_flutter] Convert overlay controllers to Swift (flutter/packages#12638) 2026-08-27 47866232+chunhtai@users.noreply.github.com [go_router_builder] Fixes text golden test to ignore platform specific newline (flutter/packages#12652) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC flutter-ecosystem@google.com 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
… and fix TextEditingController leaks (flutter#12228) This PR fixes the CupertinoIcons not being included in the actual examples and some leaks of TextEditingControllers, which were things i noticed while fixing up cross imports (which by themselves have been fixed since then) Part of flutter/flutter#187645 Since the Code Freeze period is still ongoing, I did not chance the version for cupertino_ui in the changelog yet. ## Pre-Review Checklist **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot 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. [^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.
… and fix TextEditingController leaks (flutter#12228) This PR fixes the CupertinoIcons not being included in the actual examples and some leaks of TextEditingControllers, which were things i noticed while fixing up cross imports (which by themselves have been fixed since then) Part of flutter/flutter#187645 Since the Code Freeze period is still ongoing, I did not chance the version for cupertino_ui in the changelog yet. ## Pre-Review Checklist **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot 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. [^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.
This PR fixes the CupertinoIcons not being included in the actual examples and some leaks of TextEditingControllers,
which were things i noticed while fixing up cross imports (which by themselves have been fixed since then)
Part of flutter/flutter#187645
Since the Code Freeze period is still ongoing, I did not chance the version for cupertino_ui in the changelog yet.
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