Skip to content

Commit

Permalink
document status transitions
Browse files Browse the repository at this point in the history
  • Loading branch information
EdsonBueno committed Jul 3, 2021
1 parent 61f8572 commit b2100b4
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 3.1.0

* Adds [animated status transitions](https://pub.dev/packages/infinite_scroll_pagination/example#animating-status-transitions).

## 3.0.1+1

* Adds [Flutter Favorite](https://flutter.dev/docs/development/packages-and-plugins/favorites) status to the README.
Expand Down
17 changes: 17 additions & 0 deletions example/example.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,23 @@ Widget build(BuildContext context) =>
);
```

## Animating Status Transitions
```dart
@override
Widget build(BuildContext context) =>
PagedListView<int, CharacterSummary>(
pagingController: _pagingController,
builderDelegate: PagedChildBuilderDelegate<CharacterSummary>(
animateTransitions: true,
// [transitionDuration] has a default value of 250 milliseconds.
transitionDuration: const Duration(milliseconds: 500),
itemBuilder: (context, item, index) => CharacterListItem(
character: item,
),
),
);
```

## Separators
```dart
@override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class _CharacterListViewState extends State<CharacterListView> {
child: PagedListView<int, CharacterSummary>.separated(
pagingController: _pagingController,
builderDelegate: PagedChildBuilderDelegate<CharacterSummary>(
animateTransitions: true,
itemBuilder: (context, item, index) => CharacterListItem(
character: item,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ class _CharacterSliverListState extends State<CharacterSliverList> {
PagedSliverList<int, CharacterSummary>(
pagingController: _pagingController,
builderDelegate: PagedChildBuilderDelegate<CharacterSummary>(
animateTransitions: true,
itemBuilder: (context, item, index) => CharacterListItem(
character: item,
),
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ packages:
path: ".."
relative: true
source: path
version: "3.0.1+1"
version: "3.1.0"
matcher:
dependency: transitive
description:
Expand Down
4 changes: 2 additions & 2 deletions lib/src/core/paged_child_builder_delegate.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ class PagedChildBuilderDelegate<ItemType> {
/// The builder for an indicator that all items have been fetched.
final WidgetBuilder? noMoreItemsIndicatorBuilder;

/// Whether to animate transitions between various Widget states
/// Whether status transitions should be animated.
final bool animateTransitions;

/// If animateTransitions is true, use this duration for the transition spped.
/// The duration of animated transitions when [animateTransitions] is `true`.
final Duration transitionDuration;
}
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: infinite_scroll_pagination
description: Lazily load and display pages of items as the user scrolls down your screen.
version: 3.0.1+1
version: 3.1.0
homepage: https://github.com/EdsonBueno/infinite_scroll_pagination

environment:
Expand Down

0 comments on commit b2100b4

Please sign in to comment.