BrunoJurkovic/tcard

onForward in the last card doesn't work, and isn't the same that onEnd

Closed this issue · 5 comments

First, thanks for the package, is a lot better and easier to implement than others, currently I have this problem and I'm already use a workaround, so

What is the current behavior?

The onEnd property works when the last card is show and not when the last card is dismiss, like onForward and the last one doesn't works with the last element of list

What is the expected behavior?

either of these:

  1. Make the onEnd be called when the last element of the list is dismissed
  2. Make the onForward also be called with the last element is dismiss.

Workaround

Well the simple workaround that I'm use, is add a empty widget to the last element of the list, and execute onEnd.

I don't have experience made flutter packages, so I can't contribute with this.

Issue Label Bot is not confident enough to auto-label this issue. See dashboard for more details.

Thank for issue, i will fix this weekend.

First, thanks for the package, is a lot better and easier to implement than others, currently I have this problem and I'm already use a workaround, so

What is the current behavior?

The onEnd property works when the last card is show and not when the last card is dismiss, like onForward and the last one doesn't works with the last element of list

What is the expected behavior?

either of these:

  1. Make the onEnd be called when the last element of the list is dismissed
  2. Make the onForward also be called with the last element is dismiss.

Workaround

Well the simple workaround that I'm use, is add a empty widget to the last element of the list, and execute onEnd.

I don't have experience made flutter packages, so I can't contribute with this.

Updated 👏

I'm testing and it works perfect!

it could be added to readme, that onEnd works after the last onForward or made a validation in the example like:

TCard(
  cards: cards,
  size: const Size(360, 480),
  controller: _controller,
  onForward: (index) {
    if (index < cards.lenght) {
    print(index);
    } else {
      print('last index $index');
    }
  },
  onBack: (index) {
    print(index);
  },
  onEnd: () {
    print('end');
  },
),

PS: I dont't test that code

mss30 commented

What if I want to display some text widget when onEnd triggered? Any example?