Sitelet https://github.com/flutter/packages/pull/12228
Skip to content

[cupertino_ui] fix CupertinoIcons font not being included in examples and fix TextEditingController leaks - #12228

Merged
auto-submit[bot] merged 7 commits into
flutter:mainfrom
navaronbracke:fix_cupertino_samples_cross_imports
Aug 27, 2026
Merged

auto-submit[bot] merged 7 commits into
flutter:mainfrom
navaronbracke:fix_cupertino_samples_cross_imports

Conversation

@navaronbracke

@navaronbracke navaronbracke commented Jul 17, 2026 •

Copy link
Copy Markdown
Contributor

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

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-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.

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

@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label Jul 17, 2026
@github-actions github-actions Bot added triage-framework Should be looked at in framework triage p: cupertino_ui labels Jul 17, 2026
test: ^1.31.0
vector_math: ^2.2.0
web: ^1.1.1
cupertino_icons: ^1.0.9

@navaronbracke navaronbracke Jul 17, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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

@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 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:

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.

medium

Since all cross-imports of material_ui have been removed from the cupertino_ui examples and tests, the material_ui dependency (and its path override) in pubspec.yaml is no longer needed and can be safely removed to keep the dependencies clean.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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 {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

For CupertinoTextField, instead of double tapping the word, I had to use long press to make it show up.

@Piinks

Piinks commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

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. :)
FYI @justinmc in case we determine we need to do this to remove the dev dependency, which might be an issue we ran into today.

@Piinks
Piinks marked this pull request as draft July 20, 2026 20:51
@navaronbracke

Copy link
Copy Markdown
Contributor Author

Agreed! Yeah I just put this up so I wouldn't lose track of it.

@Piinks

Piinks commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

in case we determine we need to do this to remove the dev dependency, which might be an issue we ran into today.

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 Piinks added triage-design Should be looked at in design triage and removed triage-framework Should be looked at in framework triage labels Aug 17, 2026
@dkwingsmt

Copy link
Copy Markdown
Contributor

@Piinks Is it time we resume reviewing this PR? (Also there are lots of conflicts)

@Piinks

Piinks commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

@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!

@navaronbracke

Copy link
Copy Markdown
Contributor Author

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.

@navaronbracke
navaronbracke force-pushed the fix_cupertino_samples_cross_imports branch from 8ea52a5 to e74ffbd Compare August 25, 2026 10:11
@navaronbracke
navaronbracke force-pushed the fix_cupertino_samples_cross_imports branch from fdcf7bb to f8b6af9 Compare August 25, 2026 10:33
@navaronbracke navaronbracke changed the title [cupertino_ui] fix material_ui cross imports in cupertino_ui samples [cupertino_ui] fix CupertinoIcons font not being included in examples and fix TextEditingController leaks Aug 25, 2026
class _CupertinoTextMagnifierExampleAppState
extends State<CupertinoTextMagnifierExampleApp> {
final MagnifierController _controller = MagnifierController();
final MagnifierController _magnifierController = MagnifierController();

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This one was not disposed

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.

Sorry, I'm confused. Shouldn't this be disposed (and it's not)?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Oh, this comment should be a line lower. The MagnifierController has no dispose method, but the TextEditingController was not disposed.

@navaronbracke
navaronbracke marked this pull request as ready for review August 25, 2026 10:42

@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 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);

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.

medium

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.

Suggested change
late final controller = TextEditingController(text: widget.text);
late final TextEditingController _controller = TextEditingController(text: widget.text);

Comment thread packages/cupertino_ui/example/lib/magnifier/text_magnifier.0.dart
Comment thread packages/cupertino_ui/example/lib/magnifier/text_magnifier.0.dart
Comment on lines 15 to 20
test: ^1.31.0
vector_math: ^2.2.0
web: ^1.1.1
cupertino_icons: ^1.0.9
cupertino_ui:
path: ..

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.

medium

Dependencies in pubspec.yaml should be sorted alphabetically to maintain readability and consistency across packages.

  cupertino_icons: ^1.0.9
  cupertino_ui:
    path: ..
  test: ^1.31.0
  vector_math: ^2.2.0
  web: ^1.1.1

@navaronbracke

Copy link
Copy Markdown
Contributor Author

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.

Comment thread packages/cupertino_ui/CHANGELOG.md Outdated
@@ -1,3 +1,8 @@
## 1.0.2

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.

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.

@navaronbracke
navaronbracke force-pushed the fix_cupertino_samples_cross_imports branch from b2c7568 to e7d8844 Compare August 25, 2026 15:05
@navaronbracke
navaronbracke requested a review from Piinks August 25, 2026 15:05

@dkwingsmt dkwingsmt 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.

LGTM. Thank you for the cleanup!

@dkwingsmt dkwingsmt added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 25, 2026
@auto-submit
auto-submit Bot merged commit c174155 into flutter:main Aug 27, 2026
13 checks passed
pull Bot pushed a commit to Mu-L/flutter that referenced this pull request Aug 28, 2026
…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
@navaronbracke
navaronbracke deleted the fix_cupertino_samples_cross_imports branch September 4, 2026 10:54
victorsanni pushed a commit to victorsanni/packages that referenced this pull request Sep 9, 2026
… 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.
victorsanni pushed a commit to victorsanni/packages that referenced this pull request Sep 9, 2026
… 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit Merge PR when tree becomes green via auto submit App CICD Run CI/CD p: cupertino_ui triage-design Should be looked at in design triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants