ScrollEndNotification example: auto-scroll based on RenderSliver constraints and geometry (#143538)

Adds a new ScrollNotificationEnd example that demonstrates how to trigger an auto-scroll based on an individual sliver's `SliverConstraints` and `SliverGeometry`. 

Then new example auto-scrolls one special "aligned item" sliver to the top or bottom of the viewport, whenever it's partially visible (because it overlaps the top or bottom of the viewport). This example differs from the existing ScrollEndNotification example because the layout of the to-be aligned sliver is retrieved from its `RenderSliver` via a
GlobalKey.  The new example does not rely on all of the list items having the same extent.
This commit is contained in:
Hans Muller
2024-07-02 11:46:19 -07:00
committed by GitHub
parent 9527259c70
commit acb41f3174
3 changed files with 252 additions and 0 deletions

View File

@@ -274,6 +274,18 @@ class OverscrollNotification extends ScrollNotification {
/// ** See code in examples/api/lib/widgets/scroll_end_notification/scroll_end_notification.0.dart **
/// {@end-tool}
///
///
/// {@tool dartpad}
/// This example auto-scrolls one special "aligned item" sliver to
/// the top or bottom of the viewport, whenever it's partially visible
/// (because it overlaps the top or bottom of the viewport). This
/// example differs from the previous one in that the layout of an
/// individual sliver is retrieved from its [RenderSliver] via a
/// [GlobalKey]. The example does not rely on all of the list items
/// having the same extent.
///
/// ** See code in examples/api/lib/widgets/scroll_end_notification/scroll_end_notification.1.dart **
/// {@end-tool}
/// See also:
///
/// * [ScrollStartNotification], which indicates that scrolling has started.