appinioGmbH / flutter_packages

Dart and Flutter plugins/packages used and maintained by @appinioGmbH
187 stars 214 forks source link

Appinio Swiper Package Index Issue in onSwipe Function #148

Closed Salim-Flutter closed 10 months ago

Salim-Flutter commented 1 year ago

Every developer knows that the index starts from 0, but in function named onSwipe, the index is starting from 1, due to which we are not able to dynamically implement the functionality. Please start from index 0 in this function. And do it as soon as possible so that no one else gets into trouble. This package 1.1.1 was installed in my app which was running perfectly. I was unlucky that I updated this package & got this issue. And I can't bring the old package back even if I wanted to. Because that function onSwipe becomes empty after doing downgrade.

khanmujeeb687 commented 1 year ago

Hey @Salim-Flutter , Could you please try with index-1 instead of index if that works for you ?

Salim-Flutter commented 1 year ago

No. i can't do this. The starting index is 0 of an array. So please fix this problem

On Mon, Sep 4, 2023, 11:52 Mujeeb khan @.***> wrote:

Hey @Salim-Flutter https://github.com/Salim-Flutter , Could you please try with index-1 instead of index if that works for you ?

— Reply to this email directly, view it on GitHub https://github.com/appinioGmbH/flutter_packages/issues/148#issuecomment-1704678839, or unsubscribe https://github.com/notifications/unsubscribe-auth/AZGUKIPXDSIGRXPT4MRYPVDXYVXQRANCNFSM6AAAAAA4E4DGMA . You are receiving this because you were mentioned.Message ID: @.***>

khanmujeeb687 commented 1 year ago

Hey @Salim-Flutter , This is true that the index of array starts with 0. But the purpose of onSwipe function is to tell which index the user has swiped to. So if you swipe to index 0 from 1 it will give index 0. Or if you swipe to index 5 from 4 or 6 then it will give index 5. The builder that we have starts from 0. So I think it should not be a problem. please check this comment in the package.

/// function that gets called with the new index and detected swipe direction when the user swiped or swipe is triggered by controller final OnSwipe? onSwipe;

Nico04 commented 1 year ago

I agree with @Salim-Flutter, it's very confusing. The onSwipe callback returns the direction in which the user has just swiped, so the index should be the one of the just swiped card, not the next. OK the workaround is very easy, but still, API is unclear.

bilalhamud commented 10 months ago

Fixed with version 2.1.0