Skip to content

swipperController.next() and swipperController.previous() does not change the selected card #141

Open
@JoaoSaran

Description

@JoaoSaran

I'm doing some tests and I'm calling swipperController.previous inside the onIndexChanged method of the swipper. Both next() and previous() have no effect whatsoever. Here is the code Im using:

_listPerguntas.isNotEmpty 
         ?  Swiper(
              itemCount: _listPerguntas.length,
              controller: _swiperController,
              loop: false,
              layout: SwiperLayout.TINDER,
              itemWidth: MediaQuery.of(context).size.width * 0.8,
              itemHeight: MediaQuery.of(context).size.width * 0.5,
              itemBuilder: (BuildContext context, int index) {
                return _listPerguntas[index];
              },
              onIndexChanged: (index) {
               print('index changed');
                _swiperController.previous();
              },
            )
         :  Container(),
            

is the implementation wrong or is this a legit issue?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions