[material_ui, cupertino_ui] Add migration bridge utilities - #12314
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces CupertinoUiCompatibilityBridge and MaterialUiCompatibilityBridge to facilitate migration by mapping modern theme and localization configurations to their legacy equivalents. Feedback on the changes suggests mapping the platform and visualDensity properties in MaterialUiCompatibilityBridge to ensure consistent platform-specific behaviors and layout densities.
| return legacy.ThemeData( | ||
| colorScheme: legacy.ColorScheme( |
There was a problem hiding this comment.
The platform and visualDensity properties are not mapped from modernTheme to the legacy ThemeData. This can cause inconsistent platform-specific behaviors (e.g., scroll physics, adaptive widgets) and layout densities for legacy widgets inside the bridge. Consider mapping these properties as well.
| return legacy.ThemeData( | |
| colorScheme: legacy.ColorScheme( | |
| return legacy.ThemeData( | |
| platform: modernTheme.platform, | |
| visualDensity: modernTheme.visualDensity, | |
| colorScheme: legacy.ColorScheme( |
There was a problem hiding this comment.
Good catch Gemini, or did you purposely omit these @Piinks?
There was a problem hiding this comment.
Definitely a good catch!
| // found in the LICENSE file. | ||
|
|
||
| import 'package:cupertino_ui/cupertino_ui.dart' as modern; // ignore: prefer_relative_imports | ||
| import 'package:flutter/cupertino.dart' as legacy; |
There was a problem hiding this comment.
Let's keep an eye out for any side effects of this import, but I can't think of any specific reason why it should complicate things.
| expect(capturedLegacyTheme!.textTheme.navTitleTextStyle.fontSize, 20.0); | ||
| expect(capturedLegacyTheme!.textTheme.navTitleTextStyle.fontWeight, FontWeight.bold); | ||
| expect(capturedLegacyTheme!.textTheme.actionTextStyle.color, const Color(0xFF123456)); |
There was a problem hiding this comment.
Nit: I would compare with modernTextTheme.navTitleTextStyle.fontSize instead of hard coding 20.0, and so on. That way it's clear to a reader where that value came from, and there's less chance of things getting out of sync.
| return legacy.ThemeData( | ||
| colorScheme: legacy.ColorScheme( |
There was a problem hiding this comment.
Good catch Gemini, or did you purposely omit these @Piinks?
|
Feedback addressed, PTAL! 🙂 |
…r#190351) flutter/packages@7d17fc8...5351d8c 2026-07-30 katelovett@google.com [material_ui, cupertino_ui] Add migration bridge utilities (flutter/packages#12314) 2026-07-30 269567208+reidbaker-agent@users.noreply.github.com Enforce scoped validation tools in AGENTS.md with file-based trap evals (flutter/packages#12297) 2026-07-30 engine-flutter-autoroll@skia.org Manual roll Flutter from c83f80b to 2a230d1 (6 revisions) (flutter/packages#12325) 2026-07-30 engine-flutter-autoroll@skia.org Manual roll Flutter from 0f02463 to c83f80b (7 revisions) (flutter/packages#12318) 2026-07-30 kirill.webmail@yandex.com [camera_android_camerax] Prefer higher resolution for max preset (flutter/packages#11956) 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
This adds utilities to the material_ui and cupertino_ui to help cover the gap during the ecosystem migration. Users who have migrated their applications can use these utilities to retain compatibility with packages that have not migrated yet.
These are marked deprecated as they will be removed in a future major release.
Example:
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