appinioGmbH / flutter_packages

Dart and Flutter plugins/packages used and maintained by @appinioGmbH

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[ BUG ] : Appinio Swiper: Provided example for onSwipeEnd activity is not valid

tannker opened this issue · comments

Plugin name
Appinio Swiper

Describe the bug
For onSwipeEnd following example is given in documentation:

void _swipeEnd (int previousIndex, int targetIndex, SwiperActivity activity) {
    switch (activity) {
      case Swipe():
        log('The card was swiped to the : ${activity.direction}');
        log('previous index: $previousIndex, target index: $targetIndex');
        break;
      case Unswipe():
        log('A ${activity.direction.name} swipe was undone.');
        log('previous index: $previousIndex, target index: $targetIndex');
        break;
      case CancelSwipe():
        log('A swipe was cancelled');
        break;
      case DrivenActivity():
        log('Driven Activity');
        break;
    }

However, when implementing it, Swipe(), Unswipe(), CancelSwipe() and DriveActivity() are not actually constants with latest 2.10 version.

To Reproduce
If for example Swipe() is added as a case option, then following error is shown:

_The named parameter 'begin' is required, but there's no corresponding argument. (Documentation)  Try adding the required argument.

The named parameter 'end' is required, but there's no corresponding argument. (Documentation)  Try adding the required argument.

The constructor being called isn't a const constructor. (Documentation)  Try removing 'const' from the constructor invocation.

Case expressions must be constant._

Expected behavior
Swipe() and other proposed case options has to be constants