Skip to content

Decoupling Material and Cupertino (with dart fixes)#11669

Open
justinmc wants to merge 7860 commits into
flutter:mainfrom
justinmc:decoupling-material-and-cupertino-and-fixes
Open

Decoupling Material and Cupertino (with dart fixes)#11669
justinmc wants to merge 7860 commits into
flutter: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.
  • Fix Skip all test cross imports.
  • Make sure the analyzer is working in the same exact way as it does in flutter/flutter. (Updated analysis_options from flutter/flutter #11692)

Open questions

  • Are we sure about the directory structure?
  • 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.
  • Are we cool with skipping cross imports tests and fixing them later? This approach should not fracture commits because the commits were made in flutter/flutter after the code was copied.

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

How to review this PR

  • Do read the PR description at the top, including Open Questions.
  • Don't read all 600k+ lines changed! Ignore the main source code and test files. The only thing I changed in there is to change imports from flutter/material.dart to material_ui/material_ui.dart and the equivalent for Cupertino.
  • Do look closely at the file tree browser on the left side of the "Files Changed" tab, though. Check the directory structure of material_ui and cupertino_ui and make sure it looks good to you.
  • Do take a look at the small config files like pubspecs, analysis_options, etc.
  • See the examples and their tests now located in material_ui/material_ui_examples and cupertino_ui/cupertino_ui_examples.
  • See the data driven fixes in lib/fix_data and their tests in test_fixes.

And let me know if there is any code that's not in this PR that you expected to be. It will be best to get everything we can in this one PR rather than following up later in order to prevent fragmenting commits.

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.