Skip to content

Conversation

@LowLevelSubmarine
Copy link

@LowLevelSubmarine LowLevelSubmarine commented Nov 27, 2023

When using ZoomPageTransitionsBuilder which is the default for ThemeData on Android, we always get black edges around the exiting page that is beeing zoomed out in the background. This is because both pages dont fully fill the enclosing navigators area opaque and the color for filling these pixels is always set to black. This PR aims to change this color to a more pleasent one: The current themes canvasColor.

fixes: #115275, #116127

Before

unfixed.webm

After

fixed.webm

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///). (there were no docs to change)
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@flutter-dashboard
Copy link

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 Hixie or stuartmorgan on 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.

@github-actions github-actions bot added framework flutter/packages/flutter repository. See also f: labels. f: material design flutter/packages/flutter/material repository. labels Nov 27, 2023
@flutter-dashboard
Copy link

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 package:flutter.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

Changes reported for pull request #139078 at sha d20ce4d

@flutter-dashboard flutter-dashboard bot added the will affect goldens Changes to golden files label Nov 27, 2023
@LowLevelSubmarine
Copy link
Author

LowLevelSubmarine commented Nov 27, 2023

Regarding the missing tests

I've never coded any tests in Flutter so i dont really know where to start. I'd like to know if this approach is acceptable for the flutter team first, before investing my time into writing tests for this PR.
I'd happily take any advice on how and what to test regarding this PR.

@LowLevelSubmarine LowLevelSubmarine changed the title fix: ZoomPageTransitionsBuilder always has black scrim fix: ZoomPageTransitionsBuilder always has black outlines during transitions Nov 27, 2023
@flutter-dashboard
Copy link

Golden file changes are available for triage from new commit, Click here to view.

For more guidance, visit Writing a golden file test for package:flutter.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

Changes reported for pull request #139078 at sha e408ec4

@HansMuller HansMuller self-requested a review December 1, 2023 22:47
@LowLevelSubmarine
Copy link
Author

@HansMuller thank you for taking a look at my MR. I've written a comment above regarding the missing tests. Are you in a position where you can tell me if my approach is acceptable, so that i can go on writing the tests?

@flutter-dashboard
Copy link

This pull request executed golden file tests, but it has not been updated in a while (20+ days). Test results from Gold expire after as many days, so this pull request will need to be updated with a fresh commit in order to get results from Gold.

For more guidance, visit Writing a golden file test for package:flutter.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@flutter-dashboard
Copy link

Golden file changes are available for triage from new commit, Click here to view.

For more guidance, visit Writing a golden file test for package:flutter.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

Changes reported for pull request #139078 at sha a372c85

@flutter-dashboard
Copy link

Golden file changes are available for triage from new commit, Click here to view.

For more guidance, visit Writing a golden file test for package:flutter.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

Changes reported for pull request #139078 at sha 129c579

@Piinks Piinks requested a review from victorsanni May 1, 2024 18:10
@victorsanni
Copy link
Contributor

victorsanni commented May 1, 2024

Hi @LowLevelSubmarine! Are you still planning to add tests and keep working on this PR?

@Piinks
Copy link
Contributor

Piinks commented May 29, 2024

Hey @LowLevelSubmarine thank you for the PR, since we have not heard back, I am going to close it for now. If you would like to continue working on this, we can reopen it. Thank you!

@dy0gu
Copy link
Contributor

dy0gu commented Aug 15, 2024

Hey @Piinks, the changes here solve #126682 (closed due to waiting on a framework fix) over at go_router along with both the issues mentioned at the start of this thread.

If the flutter team is okay with they way this PR fixes it I believe the only thing left is to write a test. I fail to see how such a simple change could even merit a test, seeing as nothing is removed or added, we are simply switching the hard coded Color.black with a color from the current theme to fill in the transition.

In any case, if you could give some pointers on how a test for this PR would look like I wouldn't mind taking a crack at it and having it reopened. Considering this is currently related to an issue with a P2 label (#116127), it would be great have it merged.

@victorsanni
Copy link
Contributor

victorsanni commented Aug 16, 2024

Hi @dy0gu, thanks for reaching out.

The framework requires tests to prevent your changes from being regressed. Someone could come along in the future and revert these changes, unless a test exists to at least alert them of the potential consequences of doing so.

For this PR, a good test would be something like:

  • Open flutter/packages/flutter/test/material/page_transitions_theme_test.dart to add a new test.
  • Pump an app containing this widget, but with a background color that is not black.
  • Verify that no black color is painted, but instead the background color (which is not black) is painted.

Feel free to draw inspiration from other tests in flutter/packages/flutter/test/material/page_transitions_theme_test.dart.

Thanks for your work so far, and we're looking forward to further changes so that we can reopen and merge this PR!

@victorsanni victorsanni reopened this Aug 16, 2024
@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!).

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 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.

@Piinks Piinks force-pushed the fix-zoom-page-transition-always-has-black-scrim branch from 129c579 to 1272d21 Compare August 21, 2024 18:12
@Piinks
Copy link
Contributor

Piinks commented Aug 21, 2024

Hey @dy0gu can you open a new PR with these changes? I don't know that you'll be able to push changes to this PR in particular, so I am going to close it.

@Piinks Piinks closed this Aug 21, 2024
@dy0gu
Copy link
Contributor

dy0gu commented Aug 21, 2024

Yea I noticed it when I first started working but completely forgot to tell you here that I would need to do that.

I'll create a new PR as soon as I'm done and give credit for the initial changes I take from here, thanks again!

@dy0gu
Copy link
Contributor

dy0gu commented Aug 26, 2024

For those coming to this PR from past threads, I have continued it at #154057, this time with tests!

victorsanni pushed a commit that referenced this pull request Sep 5, 2024
Fixes: #115275
Fixes: #116127
Fixes: #126682

Continuing on: #139078 (Credits to @LowLevelSubmarine for his initial
work!)

When using `ZoomPageTransitionsBuilder`, which is the default for
`ThemeData` with a `MaterialApp`, dark edges would show around the
exiting page that was being zoomed out in the background. Other times, a
scrim (what looked like a slightly transparent dark overlay over the
page) would appear.

After some experimenting it was concluded that, in the first case, this
was because both pages don't fully fill the enclosing scaffold area
during the transition and the color for filling the remaining space was
set hard coded as `Colors.black`. The second case (scrim) happens when
navigating from a page with an enclosing scaffold to a nested one,
without a scaffold, unlike the first case that happens when both pages
have a (different) enclosing scaffold, except this time it would be the
hard coded color covering the page with a slight opacity reduction.

### Changes

- Replaced the hard coded color for transition filling with the current
`ThemeData.colorScheme.surface`

- Added a RenderBox based test to verify the correct color is being used
in the transition.

## Preview

**Before, notice the dark outline flash when navigating to the first
page and the scrim when navigating to the second:**


https://github.com/user-attachments/assets/b4cc8658-1008-49f4-8553-abd5fcc72989

**After, using the theme relative color (in this case the default white)
to replace the hard coded value:**


https://github.com/user-attachments/assets/b70f42d2-6246-4964-99d1-34ff8051ab06


## 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.
- [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.

<!-- 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
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels. will affect goldens Changes to golden files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ZoomPageTransitionsBuilder black flickering on top

4 participants