Skip to content

[cupertino_ui] fix material_ui cross imports in cupertino_ui samples#12228

Draft
navaronbracke wants to merge 5 commits into
flutter:mainfrom
navaronbracke:fix_cupertino_samples_cross_imports
Draft

[cupertino_ui] fix material_ui cross imports in cupertino_ui samples#12228
navaronbracke wants to merge 5 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 cross imports of Material / material_ui in the cupertino_ui API examples.

Doc imports for material_ui are left as is, since I'm not sure what to do with those yet.

This was originally flagged in flutter/flutter#187662
because the new checker flagged 4 of the examples having cross imports.

Note: the generic text_magnifier sample was not flagged by the PR above, but it did have a cross import.
This is because the example was in the wrong place as noted by a1682d4

See https://github.com/flutter/flutter/pull/187662/changes#diff-44a841a9d512f4332f43cceddafbe29069dfaea081ae0adad3a9990c13816006R123-R126

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

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.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD p: cupertino_ui triage-framework Should be looked at in framework triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants