Repository navigation
task(deps): migrate to the standalone material_ui and cupertino_ui packages #8916
Description
Context
Material and Cupertino are no longer part of the Flutter framework. They now ship as the pub packages material_ui and cupertino_ui, maintained in flutter/packages.
package:flutter/material.dart still exists in Flutter 3.47.2, so this is available rather than forced — the app builds and the full suite passes without it. But the framework copy is the legacy path now, and the longer we sit on it the more third-party packages move across underneath us.
Deliberately kept out of the Flutter 3.47.2 bump (#8915) to keep that PR reviewable: the bump is 405 files, this would add roughly 1350 more and mix a framework migration into a toolchain change.
Why this is not the one command the README implies
The material_ui README presents step 1 as dart fix --apply --code=migrate_design_widgets. That part is real and it works — but measured against this repo, two of the three README steps also apply, and there is a fourth thing the README cannot know about.
Step 1 — imports. 1346 files under mobile/ import package:flutter/material.dart; the fix proposes 1342 changes. Mechanical, but it is the whole app plus every package.
Step 2 — localizations. Applies here. GlobalMaterialLocalizations is referenced in 9 places, including the generated lib/l10n/generated/app_localizations.dart and divine_ui. Those classes move to material_ui / cupertino_ui.
Step 3 — compatibility bridge. Applies here. Third-party packages that still import package:flutter/material.dart need MaterialUiCompatibilityBridge wired through MaterialApp.builder so ThemeData and MaterialLocalizations resolve inside modern widget trees. pro_video_editor alone has 234 such files. This touches app bootstrap, so it wants its own thought rather than a find-and-replace.
Step 4 — our own guards. Not in the README. Several ratchet detectors are Dart AST passes keyed on the MaterialApp / CupertinoApp / WidgetsApp types — check_l10n_delegates_ceiling.sh and the design-system ceilings (check_raw_dialog_ceiling.sh, check_material_button_ceiling.sh). Once those types resolve to material_ui, an unchanged detector matches nothing and silently reports a clean file. Every guard that names a Material type has to be re-pointed, and its pinned test in mobile/test/tools/ updated with it.
Notes for whoever picks this up
- The fix data ships with the
material_uipackage, not the Flutter SDK. Grepping the SDK formigrate_design_widgetsfinds nothing, which makes the code look nonexistent — it is discovered oncematerial_uiis a dependency. material_ui1.1.1 declaresflutter: ">=3.44.0", so it is compatible with our pin either way.divine_uigates at 100% coverage and is one of the migrated packages, so its own suite moves with it.- Worth splitting the mechanical import rewrite into its own commit, the way chore(deps): upgrade to Flutter 3.47.2 and drop the freezed models it breaks #8915 isolated the formatter churn, so review can skip it and focus on steps 2–4.
Done when
- The app and every package under
mobile/packages/build againstmaterial_ui/cupertino_ui - Localization delegates come from the new packages and the l10n suite passes
- Third-party consumers still on
package:flutter/material.dartrender correctly through the bridge - Every AST detector that names a Material type has been re-pointed, with its pinned test updated
- Full Mobile CI green, and a device smoke test on a real Samsung Galaxy covering camera, recording, upload and feed playback
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsTesting
Activity
chore(deps): add material_ui and cupertino_ui
refactor(deps): point every import at material_ui
fix(l10n): register material_ui's localization delegates
test: find material_ui tooltips
fix(router): keep go_router 18's behaviour changes out of the product
ci: freeze legacy Material and Cupertino imports at zero
test: navigate back through the app's own back button
refactor(deps): point rebased-in files at material_ui
chore(deps): add material_ui and cupertino_ui
25 remaining items
refactor(deps): point every import at material_ui
fix(l10n): register material_ui's localization delegates
test: find material_ui tooltips
fix(router): keep go_router 18's behaviour changes out of the product
ci: freeze legacy Material and Cupertino imports at zero
test: navigate back through the app's own back button
refactor(deps): point rebased-in files at material_ui
refactor(deps): point rebased-in follow badge files at material_ui
refactor(deps): point rebased-in chroma key files at material_ui
test(ui): follow main's material_ui move in the error-screen device test
test(ui): follow main's material_ui move in the error-screen device test
chore(deps): migrate to the standalone material_ui and cupertino_ui p…
fix(ui): show the branded error screen when a widget fails to build (d…