-
Notifications
You must be signed in to change notification settings - Fork 28.7k
Implements the Android native stretch effect as a fragment shader (Impeller-only). #169293
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
base: master
Are you sure you want to change the base?
Conversation
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. |
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. |
😭 Hi @justinmc, @dkwingsmt, @Piinks, could you please review this PR? Thanks! 😭 |
packages/flutter/lib/src/material/shaders/stretch_overscroll.frag
Outdated
Show resolved
Hide resolved
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.
Hi @MTtankkeo thanks for the contribution! This type of change would involve some changes in the engine I think.
This pull request has been changed to a draft. The currently pending flutter-gold status will not be able to resolve until a new commit is pushed or the change is marked ready for review again. 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. |
After an internal discussion between @Piinks, a couple other folks, and I, we've come to agree with the current direction to add the shader to the framework as long as it aligns with how we implement the ink sparkle. We'll take a more detailed review at this PR soon, but I just want to let you know ASAP so you don't have to look into the engine code. Sorry for the confusion! |
packages/flutter/lib/src/material/stretch_overscroll_effect.dart
Outdated
Show resolved
Hide resolved
packages/flutter/lib/src/material/stretch_overscroll_effect.dart
Outdated
Show resolved
Hide resolved
packages/flutter/lib/src/material/stretch_overscroll_effect.dart
Outdated
Show resolved
Hide resolved
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. |
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.
Code mostly looks good to me just left some minor comment.
packages/flutter/lib/src/material/shaders/stretch_overscroll.frag
Outdated
Show resolved
Hide resolved
packages/flutter/lib/src/material/shaders/stretch_overscroll.frag
Outdated
Show resolved
Hide resolved
packages/flutter/lib/src/material/shaders/stretch_overscroll.frag
Outdated
Show resolved
Hide resolved
packages/flutter/lib/src/material/shaders/stretch_overscroll.frag
Outdated
Show resolved
Hide resolved
packages/flutter/lib/src/material/stretch_overscroll_effect.dart
Outdated
Show resolved
Hide resolved
packages/flutter/lib/src/material/stretch_overscroll_effect.dart
Outdated
Show resolved
Hide resolved
Co-authored-by: Tong Mu <[email protected]>
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. |
Co-authored-by: Tong Mu <[email protected]>
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. |
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.
Thank you for the updates! Sorry again for my misguidance earlier. So excited to see this move forward.
float norm_viewport_width = 1.0; | ||
float norm_viewport_height = 1.0; | ||
|
||
out_u_norm = compute_streched_effect( |
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.
Yep, one axis assumption is safe here I think. The widget is limited to one axis, and with the 2D scrollables they have their own indicator for each axis.
packages/flutter/lib/src/widgets/stretch_overscroll_effect.dart
Outdated
Show resolved
Hide resolved
float norm_viewport_width = 1.0; | ||
float norm_viewport_height = 1.0; | ||
|
||
out_u_norm = compute_streched_effect( |
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.
@MTtankkeo can we simplify this then?
packages/flutter/lib/src/material/shaders/stretch_overscroll.frag
Outdated
Show resolved
Hide resolved
packages/flutter/lib/src/widgets/stretch_overscroll_effect.dart
Outdated
Show resolved
Hide resolved
isImpeller | ||
? 'overscroll_stretch.vertical.start.stretched.impeller.png' | ||
: 'overscroll_stretch.vertical.start.stretched.png', |
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.
Yeah, we do not need separate files like this for impeller. It's already handled by a separate test shard. For example: https://flutter-gold.skia.org/search?corpus=flutter&include_ignored=false&left_filter=name%3Dwidgets.overscroll_stretch.horizontal.rtl&max_rgba=0&min_rgba=0&negative=true¬_at_head=false&positive=true&reference_image_required=false&right_filter=&sort=descending&untriaged=true
packages/flutter/test/widgets/overscroll_stretch_indicator_test.dart
Outdated
Show resolved
Hide resolved
packages/flutter/test/widgets/overscroll_stretch_indicator_test.dart
Outdated
Show resolved
Hide resolved
Co-authored-by: Kate Lovett <[email protected]>
Co-authored-by: Kate Lovett <[email protected]>
Co-authored-by: Kate Lovett <[email protected]>
Co-authored-by: Kate Lovett <[email protected]>
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. |
Note Updated to avoid using a separate golden image name or identifier based on review feedback. |
Co-authored-by: Tong Mu <[email protected]>
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. |
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. |
Fixed an issue #82906
In the existing Flutter implementation, the Android stretch overscroll effect is achieved using Transform. However, this approach does not evenly stretch the screen as it does in the native Android environment. Therefore, in the Impeller environment, add or modify files to implement the effect using a fragment shader identical to the one used in native Android.
Note
Reference Source
Old
Skia (Using Transform)old.mp4
New
Impeller (Using fragment shader)new.mp4
Pre-launch Checklist
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.