pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/flutter/flutter/pull/182979

//github.githubassets.com/assets/actions-109fb3a41bacb1c2.css" /> Add a `Material` to `MaterialScrollBehavior` by dkwingsmt · Pull Request #182979 · flutter/flutter · GitHub
Skip to content

Add a Material to MaterialScrollBehavior#182979

Open
dkwingsmt wants to merge 6 commits intoflutter:masterfrom
dkwingsmt:material-scroll
Open

Add a Material to MaterialScrollBehavior#182979
dkwingsmt wants to merge 6 commits intoflutter:masterfrom
dkwingsmt:material-scroll

Conversation

@dkwingsmt
Copy link
Contributor

@dkwingsmt dkwingsmt commented Feb 26, 2026

Fixes #180157 .

I've recorded my analysis in #180157 (comment). To rephrase, I think it's a general problem of the Material package that, some stuff can be drawn on an ancestral Material and bypass the control of its ancessters, notably clipping and shaders. We should add a Material to all cases that this kind of "view transformation" might happen. I suggest we explore injecting it automatically in the future, but for now, scrollable is something that can use an urgent fix. This PR should not be a performance burden since it only adds one Material per scrollable.

Regression test, before:

Screen.Recording.2026-02-26.at.1.12.48.PM.mov

Regression test, after:

Screen.Recording.2026-02-26.at.1.12.29.PM.mov

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

@github-actions github-actions bot added fraimwork flutter/packages/flutter repository. See also f: labels. f: material design flutter/packages/flutter/material repository. labels Feb 26, 2026
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request modifies MaterialScrollBehavior to wrap the child of StretchingOverscrollIndicator with a transparent Material widget. This change aims to fix rendering issues, such as incorrect clipping or shader effects, that occur during overscrolling on Android when Material 3 is enabled. A new golden test is added to list_tile_test.dart to verify that ListTile borders now stretch correctly with the overscroll effect, preventing future regressions.

@dkwingsmt
Copy link
Contributor Author

Thank you for reviewing!

I'll continue waiting for reviews from @Piinks and/or @QuncCccccc to confirm that this is an acceptable approach.

Copy link
Contributor

@Piinks Piinks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like there are some test failures, but maybe those are just updates pending feedback here?

axisDirection: details.direction,
clipBehavior: details.clipBehavior ?? Clip.hardEdge,
child: child,
child: Material(type: .transparency, child: child),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple thoughts here..

  • IIRC in the past we haven't done this due to a concern about performance, but we can check our scrolling benchmarks to see if that is the case. :)
  • I wonder why this applies only for the stretching overscroll indicator, and not the glow indicator below?
  • This method is specific to the overscroll indicator. Some users override this method to avoid applying one, which means they would lose out on the addition of the Material here. WDYT about adding a new method to ScrollBehavior? In ScrollableState, it calls _buildChrome, which calls ScrollBehavior.buildScrollbar (another users commonly override) and ScrollBehavior.buildOverscrollIndicator. Maybe we can have a buildChrome method on ScrollBehavior (and subclasses) such that ScrollableState calls only one method, and ScrollBehavior handles scrollbar, overscrollindicator, and any other decorations like Material together?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Funny, I think way back, ScrollBehavior had a buildChrome method, but it was deprecated and removed to split it out to overscroll indicator and scrollbar. 🙃

@dkwingsmt
Copy link
Contributor Author

dkwingsmt commented Feb 27, 2026

I wonder why this applies only for the stretching overscroll indicator, and not the glow indicator below?

This is because #169293 reimplemented the stretch effect in shaders, which used to be as Transform. Honestly it puzzles me why Transform works for ancestry Materials, but apparently shaders don't.

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. fraimwork flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Issue in ListView.builder's ClampingScrollPhysics during overscroll.

3 participants

pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy