Home > Mobile >  How can I add pages to a flutter listview builder?
How can I add pages to a flutter listview builder?

Time:12-08

Something like this Instead of infinite scrolling in a Listview.builder.

I want to be able to see x amount of items in my ListView and then going on to the next page should show the next x amount of items.

What I have so far is just a standard ListView.builder:

Listview.Builder(
    itemCount: data.length
    itemBuilder:(context, index){

        return Card(
            child: ListTile(
                title: data[index]
            )
        );
    }
)

CodePudding user response:

like this ? Flutter: Infinite Scrolling ListView (HTTP GET)

CodePudding user response:

You can use a PageController to control which page is visible in the view. In addition to being able to control the pixel offset of the content inside the PageView, a PageController also lets you control the offset in terms of pages, which are increments of the viewport size.

The PageController can also be used to control the PageController.initialPage, which determines which page is shown when the PageView is first constructed, and the PageController.viewportFraction, which determines the size of the pages as a fraction of the viewport size.

Refer to :

geeksforgeeks

Flutter Docs

Hope this helps. Happy Coding :)

  • Related