Infinity scrolling in column is impossible in flutter?

93 views Asked by At

I use this infinite scroll library. https://pub.dev/packages/infinite_scroll_pagination infinite_scroll_pagination 4.0.0 And my infinite scroll is under the sub title text widget! like this:

body: SingleChildScrollView(
    scrollDirection: Axis.vertical,
    physics: const BouncingScrollPhysics(),
    Column(
        children: [
            Text("Sub title."),
            ...
            PagedListView(
                shrinkWrap: true,
                physics: const NeverScrollableScrollPhysics(),
                pagingController: controller.pagingController,
                builderDelegate: ...
            )
        ]
    )
)

Yeah, it's working, but it works abnormally. Make API requests all at once. I didn't scroll.

Removing SingleChildScrollView and Column works well. But i need sub title and all scrolling at body..

I want the text and the list are scrolled together and scrolling works well.

What should I do? Thank you for reading my question and have a nice day!

1

There are 1 answers

0
Md. Yeasin Sheikh On BEST ANSWER

PagedChildBuilderDelegate provides index from itemBuilder that can be used to return the Sub title only for 1st item.

builderDelegate: PagedChildBuilderDelegate<int>(
  itemBuilder: (context, item, index) => index == 0
      ? Column(
          children: [
            Text("Sub title."),
            Text(item.toString()), //yourItemBuilder
          ],
        )
      : Text(item.toString()), //yourItemBuilder
),