Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to remove the white space when the list reach out to the last item #14

Open
sopherwang opened this issue Jun 30, 2021 · 4 comments
Open

Comments

@sopherwang
Copy link

Problem: there is a large white space when the listview reaches out to the last item.

Would be great if anyone can help me to remove the white spaces.

Attached a video:

screencapture-1625080719383.mp4
@olegys
Copy link

olegys commented Oct 22, 2021

@sopherwang Good evening ! did you manage to fix it?

@mbfakourii
Copy link

@fa0311
Copy link

fa0311 commented Jan 26, 2023

You can fix this by scrollable_positioned_list

import 'package:scrollable_positioned_list/scrollable_positioned_list.dart';
const negativeItemCount = 20;
const itemCount = 40;
return ScrollablePositionedList.builder(
  itemCount: itemCount + negativeItemCount,
  initialScrollIndex: negativeItemCount,
  reverse: true,
  itemBuilder: (context, i) {
    i -= negativeItemCount;
    return ListTile(title: Text(i.toString()));
  },
);

It is also possible to create a pseudo infinite scroll by specifying a very large number

@felipe9962
Copy link

You can fix this by scrollable_positioned_list

import 'package:scrollable_positioned_list/scrollable_positioned_list.dart';
const negativeItemCount = 20;
const itemCount = 40;
return ScrollablePositionedList.builder(
  itemCount: itemCount + negativeItemCount,
  initialScrollIndex: negativeItemCount,
  reverse: true,
  itemBuilder: (context, i) {
    i -= negativeItemCount;
    return ListTile(title: Text(i.toString()));
  },
);

It is also possible to create a pseudo infinite scroll by specifying a very large number

Hi!!, I have seen your implementation and I wanted to ask you a question.

Imagine that you have a list of up to 200 elements, which you are moving as you scroll.
For example, you start at 0 and you start to scroll up and you get to 250, you have loaded the 50 oldest and you have put 50 new ones.

Why the ScrollablePositionedList asks me randomly for the number 40? How can it be solved?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants