How to make previous and next items visible using PageView in Flutter?
Asked Answered
N

3

5

How to make the previous and the next items of a PageView visible at the ends of the screen slightly?

enter image description here

Nurture answered 10/6, 2019 at 3:58 Comment(0)
R
15

First you need to specify the page controller's viewport fraction which defaults to 1.0 :

final _controller = PageController(viewportFraction: 0.7);

Then use the custom controller for your page view:

PageView.builder(
              itemCount: _pages.length,
              controller: _controller,
              itemBuilder: (BuildContext context, int index) {
                return _pages[index];
              },
            )
Ritchey answered 10/6, 2019 at 5:37 Comment(0)
M
1

To make next and previous card visible you can try to use in PageView viewportFraction

https://www.youtube.com/watch?v=_uuFKMCA1m4

Maturation answered 24/12, 2022 at 10:19 Comment(0)
G
-2

You need to reduce the width of the pages in the page view so you can display more

Gleet answered 10/6, 2019 at 5:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.