Broaden the applicability of Color fix_data rules from flutter/painting.dart#181093
Conversation
Color fix_data rules from flutter/painting.dart
|
It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging. If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group. |
There was a problem hiding this comment.
Code Review
This pull request effectively broadens the availability of data-driven fixes for the Color class by moving them from being specific to painting.dart to being applicable to dart:ui and any Flutter library that exports Color. This is a good improvement for developers. The changes are well-structured, including updates to the engine build process to accommodate dart:ui fixes and refactoring the fix data files.
I've found a minor but important typo in one of the material fix files (withValue instead of withValues), which also affected a test expectation file. I've left specific comments with suggestions to correct this. Otherwise, the changes look solid.
bwilkerson
left a comment
There was a problem hiding this comment.
The change lgtm, but I don't have the ability to approve changes in the flutter repo.
gaaclarke
left a comment
There was a problem hiding this comment.
Mostly looks good to me, i just have a few organizational questions.
| # https://dart.dev/go/data-driven-fixes. | ||
|
|
||
| # * Fixes in this file are for classes exported from the 'dart:ui' library. * | ||
|
|
There was a problem hiding this comment.
I know there is a lot of text up here already, but we should at least have a link to the other file since this is duplicated. We should make sure we don't change one without the other.
There was a problem hiding this comment.
Done. I updated both this packages/flutter fix file and also the engine's fix file to have a bit more context and to have them reference each other.
| } | ||
|
|
||
| copy("copy_dart_ui_fix_data") { | ||
| sources = [ dart_ui_fix_data_file ] |
There was a problem hiding this comment.
Could the source of this rule just be the other file? They look exactly the same.
There was a problem hiding this comment.
This source uses the engine's fix file. We shouldn't use the packages/flutter fix file here.
The engine's file uses 'dart:ui' as the URI for its fixes.
The packages/flutter file specifies 'package:flutter/*' libraries as the URIs for its fixes.
There was a problem hiding this comment.
It would be helpful if the name of the source filename matches the destination of the copy.
gaaclarke
left a comment
There was a problem hiding this comment.
lgtm, thanks for digging into this. @loic-sharma is going to be excited
|
Created fzyzcjy/flutter_portal#127 to fix the broken customer_testing tests. |
Ended up disabling the tests instead (flutter/tests#479). Updated this PR to update the customer testing commit version to include disabling those tests. |
|
autosubmit label was removed for flutter/flutter/181093, because - The status or check suite Google testing has failed. Please fix the issues identified (or deflake) before re-applying this label. |
|
autosubmit label was removed for flutter/flutter/181093, because - The status or check suite Google testing has failed. Please fix the issues identified (or deflake) before re-applying this label. |
…utter/painting.dart (flutter/flutter#181093)
Roll Flutter from 48c2475 to bfc9041eb118 (173 revisions) flutter/flutter@48c2475...bfc9041 2026-01-23 [email protected] No longer exiting the application when the RegularWindow is destroyed + resolving the window created promise after runWidget (flutter/flutter#181339) 2026-01-23 [email protected] Remove unnecessary Material import from dialog_test.dart (flutter/flutter#181249) 2026-01-23 [email protected] Roll Skia from 8e516fe6828f to db10db8bd55f (1 revision) (flutter/flutter#181379) 2026-01-23 [email protected] Reset TextFormField to initial value after state change (flutter/flutter#181199) 2026-01-23 [email protected] Roll Dart SDK from 980b2b41d36e to e82d7ad1855e (1 revision) (flutter/flutter#181375) 2026-01-23 [email protected] Roll Skia from 3e86f377d300 to 8e516fe6828f (4 revisions) (flutter/flutter#181370) 2026-01-23 [email protected] Remove unnecessary Material import from sliver_visibility_test (flutter/flutter#181248) 2026-01-23 [email protected] Add bottom navigation bar item semantics label (flutter/flutter#180577) 2026-01-23 [email protected] Make topGap not required for CupertinoSheetTransition (flutter/flutter#181269) 2026-01-23 [email protected] Roll Fuchsia Linux SDK from b4cLyhuxciUC-4zCJ... to n7NohL9DPpEuPjNt9... (flutter/flutter#181365) 2026-01-23 [email protected] Roll Dart SDK from 806f04638561 to 980b2b41d36e (1 revision) (flutter/flutter#181364) 2026-01-23 [email protected] Reland hybrid views test (flutter/flutter#181336) 2026-01-23 [email protected] Revert DropdownMenu non-nullable breaking change (flutter/flutter#181074) 2026-01-23 [email protected] Fix leaks in `flutter_test` tests (flutter/flutter#180879) 2026-01-23 [email protected] Re-enable fragment_shader_tests.dart 'Shader Compiler appropriately pads vec3 uniform arrays' test on Vulkan (flutter/flutter#181292) 2026-01-23 [email protected] [ Tool ] Fix `update-packages` failing due to mismatched dependencies between flutter_tools and the framework (flutter/flutter#181335) 2026-01-23 [email protected] [Impeller] Make dynamically created shader metadata for runtime effects consistent with metadata for built-in shaders (flutter/flutter#181201) 2026-01-23 [email protected] Broaden the applicability of `Color` fix_data rules from flutter/painting.dart (flutter/flutter#181093) 2026-01-23 [email protected] Fixes macOS App.framework not being codesigned or find framework (flutter/flutter#181348) 2026-01-22 [email protected] Roll Fuchsia GN SDK from NAEC5tfgSl8g94nwp... to JLBh4Z9PKsjIJcqDU... (flutter/flutter#181139) 2026-01-22 [email protected] Roll Dart SDK from ab4640ea82e9 to 806f04638561 (2 revisions) (flutter/flutter#181347) 2026-01-22 [email protected] Add ExpansibleController.toggle method. (flutter/flutter#181320) 2026-01-22 [email protected] Fixes Typo in codebase (flutter/flutter#181256) 2026-01-22 [email protected] Roll Skia from 4766615bcc96 to 3e86f377d300 (3 revisions) (flutter/flutter#181346) 2026-01-22 [email protected] Make sure that a Hero doesn't crash in 0x0 environment (flutter/flutter#180954) 2026-01-22 [email protected] Reland "Fix capitalization of the path to FlutterWindowControllerTest.mm in the macOS platform build script" (flutter/flutter#181200) 2026-01-22 [email protected] Roll Skia from 6e9746be8c4a to 4766615bcc96 (3 revisions) (flutter/flutter#181331) 2026-01-22 [email protected] Fix remove material import textfield (flutter/flutter#181254) 2026-01-22 [email protected] Add FlutterFramework as an Xcode SwiftPM local package override (flutter/flutter#179512) 2026-01-22 [email protected] Roll Dart SDK from 7bd4c68b625c to ab4640ea82e9 (1 revision) (flutter/flutter#181324) 2026-01-22 [email protected] Roll Packages from d80c60e to 9010299 (9 revisions) (flutter/flutter#181323) 2026-01-22 [email protected] Roll Dart SDK from 2d53a77adc5d to 7bd4c68b625c (2 revisions) (flutter/flutter#181316) 2026-01-22 [email protected] Roll Skia from 3f6949bc5780 to 6e9746be8c4a (2 revisions) (flutter/flutter#181311) 2026-01-22 [email protected] Roll Skia from ef6efc358b4a to 3f6949bc5780 (2 revisions) (flutter/flutter#181307) 2026-01-22 [email protected] Roll Dart SDK from 5d7c8faf2e41 to 2d53a77adc5d (1 revision) (flutter/flutter#181305) 2026-01-22 [email protected] [Material] update hourFormat to use Dart 3 switch expression (flutter/flutter#181041) 2026-01-22 [email protected] Use null-aware elements in cupertino/nav_bar.dart (flutter/flutter#181237) 2026-01-22 [email protected] Roll Fuchsia Linux SDK from b2KIEXVAlEqImQ9VO... to b4cLyhuxciUC-4zCJ... (flutter/flutter#181297) 2026-01-22 [email protected] Roll pub packages (flutter/flutter#181295) 2026-01-22 [email protected] Enables fragment shader test for impeller (fixes mat2 on vulkan) (flutter/flutter#181013) 2026-01-21 [email protected] Roll Dart SDK from 366200db1aa1 to 5d7c8faf2e41 (4 revisions) (flutter/flutter#181290) 2026-01-21 [email protected] Roll Skia from b5ec89e31f59 to ef6efc358b4a (19 revisions) (flutter/flutter#181289) 2026-01-21 [email protected] fix description for semantics finders (flutter/flutter#181214) 2026-01-21 [email protected] Make sure that an Icon doesn't crash in 0x0 environment (flutter/flutter#181021) 2026-01-21 [email protected] Make sure that a GridPaper doesn't crash in 0x0 environment (flutter/flutter#180906) 2026-01-21 [email protected] Bring Linux coverage out of bringup (flutter/flutter#181280) ...
|
This is awesome!!!! Thank you @b-luk \o/ |
…ting.dart (flutter#181093) See the conversation at dart-lang/sdk#59764 (comment) for more context. Prior to this, these `Color` fix_data rules would only be visible to users that explicitly import `package: flutter/painting.dart`. This PR broadens the applicability of these rules so they are visible for users that import `dart:ui`, or import any one of the `flutter/` packages that expose `Color`. #### Enabling `Color` fix_data fixes for `dart:ui`: - Adds a `fix_data.yaml` file for `'dart:ui'` fixes to `engine/src/flutter/lib/ui/`. This contains `Color` fixes copied from `packages/flutter/lib/fix_data/fix_painting.yaml`. - Typically `fix_data` files go in a Dart package's `lib/` directory. But `dart:ui` is not a standard Dart package and doesn't have a typical `lib` directory. This directory is the closest thing to a `lib` directory for the `dart:ui` package that I can find. It contains the Dart code that implements the `dart:ui` package. - The actual Dart package for `dart:ui` is generated by `engine/src/flutter/sky/packages/sky_engine/BUILD.gn` with the package name `sky_engine`. I updated the build rule to copy the new `fix_data.yaml` file into the generated `sky_engine/lib/` directory. #### Enabling `Color` fix_data fixes for `package:flutter/` libraries: - The `Color` fixes from `packages/flutter/lib/fix_data/fix_painting.yaml` are remove, and copied to over to a new `packages/flutter/lib/fix_data/fix_dart_ui.yaml` file. - This fix_data file specifies all the `flutter/` libraries which export `Color`. With this change, importing any of these libraries will surface the `Color` fixes, rather than only surfacing the fixes only when `package:flutter/painting.dart` is specifically imported. #### Other related changes - Updates some entries in `fix_cupertino.yaml` and `fix_material.yaml` which used the old `Color.withOpacity` method. - Updates existing flutter package `test_fixes` tests. - The color tests from the `painting` `test_fixes` test are moved to a new `dart_ui` test. Note that this only runs the test with only one of the `flutter/` libraries specified in `fix_dart_ui.yaml` (`animation.dart`). Ideally I think we should run this test while independently importing each one of the `flutter/` libraries specified in `fix_dart_ui.yaml`. But AFAICT there's no easy way to do this without creating a lot of duplicate code. - There is no `fix_data` test for `dart:ui`. Because this isn't a standard Dart library, I don't think there's an easy way to test its `fix_data.yaml` in a similar way to the `flutter/` library fixes. Somewhat fixes flutter#180933 (makes the fixes more broadly available). Somewhat addresses dart-lang/sdk#59764 (comment) (establishes a way to use `fix_data.yaml` files for `dart:X` libraries). ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. 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](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot 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. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
See the conversation at dart-lang/sdk#59764 (comment) for more context.
Prior to this, these
Colorfix_data rules would only be visible to users that explicitly importpackage: flutter/painting.dart. This PR broadens the applicability of these rules so they are visible for users that importdart:ui, or import any one of theflutter/packages that exposeColor.Enabling
Colorfix_data fixes fordart:ui:fix_data.yamlfile for'dart:ui'fixes toengine/src/flutter/lib/ui/. This containsColorfixes copied frompackages/flutter/lib/fix_data/fix_painting.yaml.fix_datafiles go in a Dart package'slib/directory. Butdart:uiis not a standard Dart package and doesn't have a typicallibdirectory. This directory is the closest thing to alibdirectory for thedart:uipackage that I can find. It contains the Dart code that implements thedart:uipackage.dart:uiis generated byengine/src/flutter/sky/packages/sky_engine/BUILD.gnwith the package namesky_engine. I updated the build rule to copy the newfix_data.yamlfile into the generatedsky_engine/lib/directory.Enabling
Colorfix_data fixes forpackage:flutter/libraries:Colorfixes frompackages/flutter/lib/fix_data/fix_painting.yamlare remove, and copied to over to a newpackages/flutter/lib/fix_data/fix_dart_ui.yamlfile.flutter/libraries which exportColor. With this change, importing any of these libraries will surface theColorfixes, rather than only surfacing the fixes only whenpackage:flutter/painting.dartis specifically imported.Other related changes
fix_cupertino.yamlandfix_material.yamlwhich used the oldColor.withOpacitymethod.test_fixestests.paintingtest_fixestest are moved to a newdart_uitest. Note that this only runs the test with only one of theflutter/libraries specified infix_dart_ui.yaml(animation.dart). Ideally I think we should run this test while independently importing each one of theflutter/libraries specified infix_dart_ui.yaml. But AFAICT there's no easy way to do this without creating a lot of duplicate code.fix_datatest fordart:ui. Because this isn't a standard Dart library, I don't think there's an easy way to test itsfix_data.yamlin a similar way to theflutter/library fixes.Somewhat fixes #180933 (makes the fixes more broadly available).
Somewhat addresses dart-lang/sdk#59764 (comment) (establishes a way to use
fix_data.yamlfiles fordart:Xlibraries).Pre-launch Checklist
///).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.