Skip to content

Commit

Permalink
fix rounding error
Browse files Browse the repository at this point in the history
  • Loading branch information
alextran1502 committed Sep 9, 2024
1 parent 6427763 commit 3fd6509
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions mobile/lib/widgets/asset_grid/draggable_scrollbar_custom.dart
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,16 @@ class DraggableScrollbarState extends State<DraggableScrollbar>

_currentItem = itemPosition;

/// If the bar is at the bottom but the item position is still smaller than the max item count (due to rounding error)
/// jump to the end of the list
if (barMaxScrollExtent - _barOffset < 10 && itemPosition < maxItemCount) {
widget.controller.jumpTo(
index: maxItemCount,
);

return;
}

widget.controller.jumpTo(
index: itemPosition,
);
Expand Down

0 comments on commit 3fd6509

Please sign in to comment.