Skip to content

Commit 2f15431

Browse files
authored
Update docs and versions for publishing for ScrollOffsetListener (#473)
* Update readme for scroll offset * Update version for releasing scroll offset listening
1 parent 3bad43f commit 2f15431

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

packages/scrollable_positioned_list/CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# 0.3.7
2+
* Add ScrollOffsetListener to allow listening to changes in scroll offset.
3+
14
# 0.3.6
25
* Fix cache extents for horizontal lists
36
* scrollTo future doesn't complete until scrolling is done.

packages/scrollable_positioned_list/README.md

+11
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,14 @@ A `ScrollablePositionedList` can be created with:
1616
```dart
1717
final ItemScrollController itemScrollController = ItemScrollController();
1818
final ItemPositionsListener itemPositionsListener = ItemPositionsListener.create();
19+
final ScrollOffsetListener scrollOffsetListener = ScrollOffsetListener.create()
1920
2021
ScrollablePositionedList.builder(
2122
itemCount: 500,
2223
itemBuilder: (context, index) => Text('Item $index'),
2324
itemScrollController: itemScrollController,
2425
itemPositionsListener: itemPositionsListener,
26+
scrollOffsetListener: scrollOffsetListener,
2527
);
2628
```
2729

@@ -46,6 +48,15 @@ One can monitor what items are visible on screen with:
4648
itemPositionsListener.itemPositions.addListener(() => ...);
4749
```
4850

51+
Changes in scroll position can be monitored with:
52+
53+
```dart
54+
scrollOffsetListener.changes.listen((event) => ...)
55+
```
56+
57+
see `ScrollSum` in [this test](test/scroll_offset_listener_test.dart) for an example of how the current offset can be
58+
calculated from the stream of scroll change deltas. This feature is new and experimental.
59+
4960
A full example can be found in the example folder.
5061

5162
--------------------------------------------------------------------------------

packages/scrollable_positioned_list/pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: scrollable_positioned_list
2-
version: 0.3.6
2+
version: 0.3.7
33
description: >
44
A list with helper methods to programmatically scroll to an item.
55
homepage: https://github.com/google/flutter.widgets/tree/master/packages/scrollable_positioned_list

0 commit comments

Comments
 (0)