Skip to content

Commit

Permalink
feat: Calculate targetPixels for PageViewTypeScrollPhysics same as ac…
Browse files Browse the repository at this point in the history
…tual PageView physics
  • Loading branch information
manuindersekhon committed Feb 16, 2024
1 parent a413b6b commit f6ac4c5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/src/infinite_carousel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@ class PageViewTypeScrollPhysics extends ScrollPhysics {
double _getTargetPixels(
_InfiniteScrollPosition metrics, Tolerance tolerance, double velocity) {
int item = metrics.itemIndex;
if (velocity * metrics.velocityFactor < -tolerance.velocity) {
if (velocity < -tolerance.velocity) {
item -= 1;
} else if (velocity > tolerance.velocity) {
item += 1;
Expand Down Expand Up @@ -639,7 +639,7 @@ class PageViewTypeScrollPhysics extends ScrollPhysics {
spring,
metrics.pixels,
targetPixels,
velocity * metrics.velocityFactor,
velocity,
tolerance: tolerance,
);
}
Expand Down

0 comments on commit f6ac4c5

Please sign in to comment.