Skip to content

Decoupling Material and Cupertino (with dart fixes)#11669

Open
justinmc wants to merge 7851 commits intoflutter:mainfrom
justinmc:decoupling-material-and-cupertino-and-fixes
Open

Decoupling Material and Cupertino (with dart fixes)#11669
justinmc wants to merge 7851 commits intoflutter:mainfrom
justinmc:decoupling-material-and-cupertino-and-fixes

Conversation

@justinmc
Copy link
Copy Markdown
Contributor

@justinmc justinmc commented May 7, 2026

This is a single super mega PR attempting to migrate all Material and Cupertino code from flutter/flutter to material_ui and cupertino_ui.

To create this PR I used:

git filter-repo --path packages/flutter/lib/src/material --path packages/flutter/test/material --path examples/api/lib/material --path examples/api/test/material --path packages/flutter/lib/src/cupertino --path packages/flutter/test/cupertino --path examples/api/lib/cupertino --path examples/api/test/cupertino --path packages/flutter/lib/fix_data/fix_material --path packages/flutter/test_fixes/material --path packages/flutter/lib/fix_data/fix_cupertino.yaml --path packages/flutter/test_fixes/cupertino 
cd ../packages
git remote add source-origin ../flutter
git fetch source-origin
git merge source-origin/master --allow-unrelated-histories

I then cherry picked everything I could from the previous PR (#11568).

For both Material and Cupertino, I'm importing:

  • The main source code (packages/flutter/lib/src/<material/cupertino>).
  • The widget/unit tests (packages/flutter/test/<material/cupertino>).
  • The examples (examples/api/lib/<material/cupertino>).
  • The example tests (examples/api/test/<material/cupertino>).
  • The dart fixes (packages/flutter/lib/fix_data).
  • The dart fix tests (packages/flutter/test_fixes).

TODOs

  • Do exports for Material and Cupertino.
  • Confirm the directory structure (current plan: lib/src/ for now, reorganize after 1.0.0).
  • Try installing and using the packages locally.
  • Try running the tests locally (works except for tests with cross imports).
  • Try running the example tests locally (work after migrating package:flutter_api_samples import).
  • Verify examples work.
  • Verify that git blame appears the same in both repos on various files. (Yes, but the SHAs are different, as expected.)
  • Add auxiliary files for dart fixes and tests.
  • Port imports of material/cupertino in places like examples/test to use the new packages.
  • Make sure the analyzer is working in the same exact way as it does in flutter/flutter.
  • Fix all test cross imports, or decide to merge this without them and fix later. Can these fixes be ported afterwards? The problem of partial commit SHAs shouldn't apply to these new things.

Open questions

  • Are we sure about the directory structure?
    • What happens when a user imports material_ui.dart and there are things with the same name in both m3 and m3e?
  • Anything else that should be ported along with this? If these commits touch files that are not included in this PR, but that we later port in, the commits will likely have different SHAs.
  • Do we like the examples setup? Separate package at material_ui_examples that points to material_ui via the pubspec workspace. Similar to how flutter/flutter's flutter_api_samples works.

How to try using these packages

Add the local packages to your project:

flutter pub add cupertino_ui --path ../../packages/packages/cupertino_ui
flutter pub add material_ui --path ../../packages/packages/material_ui  

Then import the packages instead of the libraries in the SDK:

- import 'package:flutter/material.dart';
- import 'package:flutter/cupertino.dart';
+ import 'package:material_ui/material_ui.dart';
+ import 'package:cupertino_ui/cupertino_ui.dart';

Resources

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

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.