-1

In my book-like Flutter app, there is a requirement to swipe in horizontal direction in order to navigate to previous and next page. I looked for a package which does something like that in pub.dev and didn't find. I'd like to know if there is already something like that to not-invent a wheel. If not, I'd like to hear (not excepting you to make it for me) what approach can be taken in order to implement it by myself.

chrome side swipe

Dorad
  • 3,413
  • 2
  • 44
  • 71

1 Answers1

1

What you're looking for is the PageView widget. Just provide the pages, the swiping functionality is built-in.

PageView(
  controller: _controller,
  children: [
    MyPage1Widget(),
    MyPage2Widget(),
    MyPage3Widget(),
  ],
)

Since you're saying it's for a book which likely has a lot of pages you might want to use PageView.builder() instead of better performance.

There's a more information about the widget here

Alex Schneider
  • 364
  • 2
  • 7
  • As mentioned, I looked at pub.dev, but didn't think that a standard component might exists... I took my lesson. It works great with PageView.builder. thanks. – Dorad Dec 02 '21 at 19:40