-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Improve CupertinoPopupSurface appearance #151430
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact "@test-exemption-reviewer" in the #hackers channel in Chat (don't just cc them here, they won't see it! Use Discord!). 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. |
|
The difference is phenomenal! I have the following problems:
|
static List<double> buildLightColorFilterMatrix() {
const double lightLumR = 0.26;
const double lightLumG = 0.4;
const double lightLumB = 0.17;
const double saturation = 2.0;
const double sr = (1 - saturation) * lightLumR;
const double sg = (1 - saturation) * lightLumG;
const double sb = (1 - saturation) * lightLumB;
return <double>[
sr + saturation, sg, sb, 0.0, 0.0, //
sr, sg + saturation, sb, 0.0, 0.0, //
sr, sg, sb + saturation, 0.0, 0.0, //
0.0, 0.0, 0.0, 1.0, 0.0, //
];
}
static List<double> buildDarkColorFilterMatrix() {
const double additive = 0.3;
const double darkLumR = 0.45;
const double darkLumG = 0.8;
const double darkLumB = 0.16;
const double saturation = 1.7;
const double sr = (1 - saturation) * darkLumR;
const double sg = (1 - saturation) * darkLumG;
const double sb = (1 - saturation) * darkLumB;
return <double>[
sr + saturation, sg, sb, 0.0, additive, //
sr, sg + saturation, sb, 0.0, additive, //
sr, sg, sb + saturation, 0.0, additive, //
0.0, 0.0, 0.0, 1.0, 0.0, //
];
}
|
Added equation to derive color filter
Add whitespace back
|
About unit test, my idea is:
|
Co-authored-by: Tong Mu <dkwingsmt@users.noreply.github.com>
Co-authored-by: Tong Mu <dkwingsmt@users.noreply.github.com>
|
Golden file changes have been found for this pull request. Click here to view and triage (e.g. because this is an intentional change). If you are still iterating on this change and are not ready to resolve the images on the Flutter Gold dashboard, consider marking this PR as a draft pull request above. You will still be able to view image results on the dashboard, commenting will be silenced, and the check will not try to resolve itself until marked ready for review. For more guidance, visit Writing a golden file test for Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
I'm not sure if this is easily done without reaching into the engine, but correct me if I'm wrong. ColorFilters appear to be composed and applied directly by skia (at least, as far as I can tell... I'm not too familiar with the native layer of Flutter):
https://api.skia.org/classSkColorFilters.html I added a few Goldens to test the surface changes, but I'm interested to hear if there is a better way to handle this. |
…IsWeb conditional.
|
Golden file changes are available for triage from new commit, Click here to view. For more guidance, visit Writing a golden file test for Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
|
Ok, I've found the reasons. First, in "unpainted" tests, the two golden files are using the same name and the doc says that the theme shouldn't affect the result. This is incorrect, because the theme does affect the result, since the color filters are different. Second, in "unpainted" tests, the filters isn't applied at all, because there's nothing within the filter and the layer is dropped. By adding an empty While this shouldn't be a problem for production code (since there'll always be a child), I suggest making // popup_surface_test.dart, L100
Padding(
padding: const EdgeInsets.all(16.0),
child: CupertinoPopupSurface(
isSurfacePainted: isSurfacePainted,
child: child,
),
),Third, as I pointed in the comment, I wonder why a 3rd layer of 18 strips is painted on top of the pop up surface. Is it used as the master for comparison? I don't think this is very useful though. Without it the result is very obvious and beautiful: My suggestion: I thought the backdrop filters don't apply to golden images, but it turns out they do. In this case, I still think most of the test cases should be used to test the color change (since that's the most complicated part), and these test should be done without the blurring effect for accuracy, while some separate tests should be used to verify the blurring effect.
|
|
Golden file changes are available for triage from new commit, Click here to view. For more guidance, visit Writing a golden file test for Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
|
This should now be updated with skip annotations, i.e. skip: kIsWasm, // https://github.com/flutter/flutter/issues/152026I also updated a few tests to make them more specific based on the testing guidelines -- I think I had skipped one of the testing documents from the contributing guidelines, so sorry for the late update! Largest difference was splitting 'Nonpositive blurSigma removes blur' into 'Setting blurSigma to a negative number throws' and 'Setting blurSigma to zero removes blur'. |
| /// | ||
| /// The saturation effect can be removed for debugging by setting | ||
| /// [debugIsVibrancePainted] to false. The saturation effect is not supported on | ||
| /// the html web renderer and will not be applied regardless of the value of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| /// the html web renderer and will not be applied regardless of the value of | |
| /// web with the skwasm renderer and will not be applied regardless of the value of |
The HTML renderer has been deprecated and removed https://docs.flutter.dev/platform-integration/web/renderers so we only mention skwasm here.
|
Thank you for your update! Being unsupported by skwasm is unfortunate but it'll probably be solved in the future and doesn't reduce the value of this PR. I found a fix to the doc and otherwise we're ready to go. |
|
Look perfect :) |
|
I've created an issue to remind us the skwasm issue. #154698 |
flutter/flutter@45ef8f3...2e221e7 2024-09-06 leroux_bruno@yahoo.fr Fix DropdownMenu focused item styles (flutter/flutter#153159) 2024-09-06 phucloi.nguyen@manabie.com Support custom transition duration for `DialogRoute`, `CupertinoDialogRoute` and show dialog methods. (flutter/flutter#154048) 2024-09-06 51940183+Sameri11@users.noreply.github.com [tool] Add `dartFileName` setting for platform plugins (flutter/flutter#153099) 2024-09-06 reidbaker@google.com [Conductor] Add ability to override mirror, add tests for default arg parsing and custom arg parsing (flutter/flutter#154363) 2024-09-06 59215665+davidhicks980@users.noreply.github.com Improve CupertinoPopupSurface appearance (flutter/flutter#151430) 2024-09-06 engine-flutter-autoroll@skia.org Roll Packages from 71e827e to 56df73e (1 revision) (flutter/flutter#154725) 2024-09-06 goderbauer@google.com Quick access to style guide (flutter/flutter#154689) 2024-09-06 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Roll Flutter Engine from c50eb8a65097 to 015f3b1dec53 (2 revisions) (#154691)" (flutter/flutter#154726) 2024-09-05 737941+loic-sharma@users.noreply.github.com Improve iOS unpack target's error messages (flutter/flutter#154649) 2024-09-05 30870216+gaaclarke@users.noreply.github.com Made some pixel tests fuzzy (flutter/flutter#154680) 2024-09-05 engine-flutter-autoroll@skia.org Roll Flutter Engine from c50eb8a65097 to 015f3b1dec53 (2 revisions) (flutter/flutter#154691) 2024-09-05 49699333+dependabot[bot]@users.noreply.github.com Bump peter-evans/create-pull-request from 7.0.0 to 7.0.1 (flutter/flutter#154690) 2024-09-05 36861262+QuncCccccc@users.noreply.github.com Normalize Dialog theme (flutter/flutter#153982) 2024-09-05 chris@bracken.jp iOS,macOS: Do not copy unsigned_binaries.txt to build outputs (flutter/flutter#154684) 2024-09-05 engine-flutter-autoroll@skia.org Roll Flutter Engine from e042ff5df7af to c50eb8a65097 (1 revision) (flutter/flutter#154679) 2024-09-05 34871572+gmackall@users.noreply.github.com Add proguard rule to keep the class for all implementations of FlutterPlugin (flutter/flutter#154677) 2024-09-05 bruno.leroux@gmail.com Fix DropdownMenu menu does not follow the text field (flutter/flutter#154667) 2024-09-05 engine-flutter-autoroll@skia.org Roll Flutter Engine from a156e713f4dc to e042ff5df7af (1 revision) (flutter/flutter#154678) 2024-09-05 103767860+dy0gu@users.noreply.github.com Fix ZoomPageTransitionsBuilder hardcoded fill color (flutter/flutter#154057) 2024-09-05 engine-flutter-autoroll@skia.org Roll Flutter Engine from 34b61eb53b99 to a156e713f4dc (1 revision) (flutter/flutter#154672) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC bmparr@google.com,rmistry@google.com,stuartmorgan@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
This reverts commit 35b0349.
#151430 had to be reverted because of a black square appearing during animations. This PR fixes the issue by switching from BlendMode.src -> BlendMode.srcOver. I visually checked to make sure the issue was fixed on MacOS and iOS/Android simulators. Fixes #154887 ## 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]. <!-- 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 --------- Co-authored-by: Tong Mu <dkwingsmt@users.noreply.github.com>




This PR makes the CupertinoPopupSurface more vibrant. Also, the gaussian kernel was switched to 30 from 20 based on comparisons.
@dkwingsmt - Looking forward to your dialog and fixes!
After is on bottom:

Notably, because the borders are very transparent, the new version looks more colorful in the sample screencap than it actually is. As such, focus on the individual colors to get a feel for the change.
Partially addresses #29483
This will need tests, which I will add once I know which tests break due to this commit.
Blockers:
BackdropFilterdoes not work when compiling with --wasm #152026Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.