Skip to content

Commit

Permalink
fetch index fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dinaraparanid committed Nov 26, 2024
1 parent 4d250a7 commit a4531b6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ migrate_working_dir/

# Flutter/Dart/Pub related
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock.
/pubspec.lock
*.lock
**/doc/api/
.dart_tool/
.packages
Expand Down
4 changes: 2 additions & 2 deletions lib/src/widget/bidirectional_paging_list_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -474,9 +474,9 @@ class _BidirectionalPagingListViewState<Key, Value>
// Check if the index corresponds to near the top or bottom based on the
// 'reverse' flag.
final nearTop =
reverse ? index == itemCount - fetchIndex : index == fetchIndex;
reverse ? index >= itemCount - fetchIndex : index <= fetchIndex;
final nearBottom =
reverse ? index == fetchIndex : index == itemCount - fetchIndex;
reverse ? index <= fetchIndex : index >= itemCount - fetchIndex;

// Generate prepend notification.
if (nearTop) onBuildingPrependLoadTriggerItem?.call();
Expand Down
4 changes: 2 additions & 2 deletions lib/src/widget/paging_sliver_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -271,12 +271,12 @@ class _PagingSliverListState<Key, Value>
if (prefetchIndex == null) return;

// Generate prepend notification.
if (index == prefetchIndex) {
if (index <= prefetchIndex) {
onBuildingPrependLoadTriggerItem?.call();
}

// Generate append notification.
if (index == itemCount - prefetchIndex) {
if (index >= itemCount - prefetchIndex) {
onBuildingAppendLoadTriggerItem?.call();
}
}
Expand Down

0 comments on commit a4531b6

Please sign in to comment.