[cupertino_ui,material_ui] Import from flutter/flutter (#11888) A recreate of https://github.com/flutter/packages/pull/11669 by recopying all flutter/flutter stuff from scratch, and cherry picking all of my subsequent commits. This is a single super mega PR attempting to migrate all Material and Cupertino code from flutter/flutter to material_ui and cupertino_ui. ### How the PR was created ``` 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 (https://github.com/flutter/packages/pull/11669), skipping merge commits. ### What was included in the copy * 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 * [x] Do exports for Material and Cupertino. * [x] Confirm the directory structure (current plan: lib/src/ for now, reorganize after 1.0.0). * [x] Try installing and using the packages locally. * [x] Try running the tests locally (works except for tests with cross imports). * [x] Try running the example tests locally (work after migrating `package:flutter_api_samples` import). * [x] Verify examples work. * [x] Verify that `git blame` appears the same in both repos on various files. (Yes, but the SHAs are different, as expected.) * [x] Add auxiliary files for dart fixes and tests. * [x] Port imports of material/cupertino in places like examples/test to use the new packages. * [x] ~~Fix~~ Skip all test cross imports. * [x] Make sure the analyzer is working in the same exact way as it does in flutter/flutter. (https://github.com/flutter/packages/pull/11692) ### Open questions * ~~Are we sure about the directory structure?~~ * Confirmed with @dkwingsmt and @QuncCccccc. * 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. * I'm hoping we got it all at this point but if anyone notices anything let me know. * ~~Do we like the examples setup?~~ * Worked with @stuartmorgan-g and @chunhtai to get this to match the other packages in this repo. * 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. * Tests are in the temporarily_skipped_tests folder. ### 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: ```diff - 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 * Closed PR where i tried to import everything but forgot dart fixes. - https://github.com/flutter/packages/pull/11568 * Closed PR where I tried and failed to import a single widget by individually importing all of its transitive dependencies with `git filter-repo` commands. * https://github.com/flutter/packages/pull/11526 * Closed PR where I tried to import just colors.dart (no dependencies), but found that it would create different SHAs between it and this mega PR. * https://github.com/flutter/packages/pull/11543 * Closed PR where I tried to import all of Material, before realizing that I would create different SHAs between that PR and a future Cupertino PR. * https://github.com/flutter/packages/pull/11549 * Closed main big PR with most of the history: https://github.com/flutter/packages/pull/11669 * Closed PR where I tried to cherry pick everything: https://github.com/flutter/packages/pull/11887
This repo is a companion repo to the main flutter repo. It contains the source code for Flutter's first-party packages (i.e., packages developed by the core Flutter team). Check the packages directory to see all packages.
These packages are also available on pub.
Please file any issues, bugs, or feature requests in the main flutter repo. Issues pertaining to this repository are labeled “package”.
If you wish to contribute a new package to the Flutter ecosystem, please see the documentation for developing packages. You can store your package source code in any GitHub repository (the present repo is only intended for packages developed by the core Flutter team). Once your package is ready you can publish to the pub repository.
If you wish to contribute a change to any of the existing packages in this repo, please review our contribution guide, and send a pull request.
These are the packages hosted in this repository: