marcglasberg / indexed_list_view

Flutter package: Similar to a ListView, but lets you programmatically jump to any item, by index.
BSD 2-Clause "Simplified" License
251 stars 21 forks source link

minScrollExtent = double.negativeinfinity causes perception of list hung #3

Closed jagan999 closed 5 years ago

jagan999 commented 6 years ago

Sorry for filing one more issue :-(

Since you allow infinite scrolling on either side, when I scroll to the top of the list and pull it down, it gives a perception that the list view is hung since it's probably still processing the negativeinfinity scroll extent. I tried setting minScrollExtent = 0.0 and it seems to work fine.

Can you pl look into this as well?

marcglasberg commented 6 years ago

There is no need to feel sorry. Please post issues for all problems you find. I use this package myself and need it working as perfect as possible.

But, again, I'm not so sure what you mean. In https://pub.dartlang.org/packages/indexed_list_view there is a TODO that states:

[ ] Fixing a bug where under certain rare circumstances the user can't stop a ballistic scroll until it stops by itself.

This happens when you are in the positive part and scroll to the negative part (or you are in the negative part and scroll to the positive part). Then you can't stop the scroll movement until it stops by itself.

Is that the issue you refer to? If so, this is a known problem, and I know exactly why it happens but I don't know how to solve it. My experience with Flutter's scrolling API is rather limited, and I would need help from the community to effectively fix this.

marcglasberg commented 5 years ago

Version 1.0.0 was released, and solved this problem.

ssalihu commented 5 years ago

Love this plugin!

I tried version 1.0.0 and the infinite scroll issue is happening. Both scroll up and down seems to go for infinite scroll. What could I be doing wrong?

Sample Code below...

  Widget buildDisplayList() {
    int jumpTo = this.offset <=0?0:this.offset-1;
    IndexedScrollController controller =
                        IndexedScrollController(initialIndex: jumpTo);
      return IndexedListView.separated(
        scrollDirection: Axis.vertical,
        controller: controller,
        reverse: false,
        separatorBuilder: (context, index) => Divider(
          color: Colors.blueGrey,
        ),
      itemCount: offices.length,
      itemBuilder: (builder, index) {
        final locations.Office office = offices[index];
        final String title =  (index + 1).toString() + '. ' + office.name + ' ' + office.address;
        final String subTitle = office.description;
        return new GestureDetector(
            onTap: () => print(office.name),
            child: ListTile( title: Text( title, style: TextStyle(fontWeight: FontWeight.bold), ),
                subtitle: Text(subTitle)));
      },
    );
  }  
marcglasberg commented 5 years ago

The list in this package is infinite, and it's unlikely that's going to change.

However, the "perception of list hung" does not happen anymore in this version. Right?

ssalihu commented 5 years ago

Correct, I do not see any hung scenarios.

So on the infinite list topic - if the list is infinite, it does have an issue with UI when you get to the top and bottom of the list. There is no end to scroll. Any recommendations on how to go about addressing this?

marcglasberg commented 5 years ago

The recommendation is using this package only when you need infinite lists. For example: Calendars. If you have finite list you have to use something else.