Giter VIP home page Giter VIP logo

Comments (10)

zefaxet avatar zefaxet commented on July 26, 2024 10

I agree with creating a new widget for this. I was going to suggest that next so it's good to see there's room for the feature if the demand comes.

from infinite_scroll_pagination.

EdsonBueno avatar EdsonBueno commented on July 26, 2024 9

It can definitely be done, and the API you suggested would work. But, I'm afraid the inner workings of this aren't that simple, not to mention the visual aspects (loading and error indicators).
Another thing we have to keep in mind, is that if this isn't something lots of users need, it would just bloat up the API and make the package more confusing to use. To avoid that, we could create a new BidirectionalPagingController.

I'll keep an eye on this, and if enough users start asking for it, I can give it a try.
For now, if the other package solves your problem, I suggest going with it.

from infinite_scroll_pagination.

zefaxet avatar zefaxet commented on July 26, 2024 5

When you say it's not possible, do you mean just as a limitation of this widget?
This other repository:
https://github.com/fluttercommunity/flutter_infinite_listview
accomplishes what @valerybodak is asking for, but it uses the normal index-based generator scheme that the normal ListView uses. I would prefer to use the key-based builder pattern implemented on this widget, and it seems to me like a small effort to combine these two features here.

I'm eager to hear what your thoughts are here, but in the meantime I and others may have to rely on the alternatives like the one I linked to meet this specific need.

from infinite_scroll_pagination.

EdsonBueno avatar EdsonBueno commented on July 26, 2024 4

Ooooh, wow! Now I get it...
No, that's not possible...

from infinite_scroll_pagination.

EdsonBueno avatar EdsonBueno commented on July 26, 2024 1

Yes, it is!
Set the reverse property from PagedListView to true.
Keep in mind that the "page ordering" is on you. The PagingController will ask first whatever page number you provided on its constructor.

from infinite_scroll_pagination.

valerybodak avatar valerybodak commented on July 26, 2024 1

@EdsonBueno
But looks like we can't enable the pagination to both directions (up & down). For example, if the initial index is 2, I need to scroll down to fetch page 3 etc. and I need to scroll up to fetch 1, 0.
Can I enable this behaviour?

from infinite_scroll_pagination.

EdsonBueno avatar EdsonBueno commented on July 26, 2024

@zefaxet From what I could understand, the package you listed has nothing to do with pagination, it's just a circular ListView. When you reach the end of it, you start seeing the initial items again.
Did I got it wrong? If not, it's nowhere close to what @valerybodak needs.

What @valerybodak wants is to start showing the user the third page (for example). Then if the user scrolls up, we lazily fetch the second page. If he scrolls down, we lazily fetch the fourth page.

from infinite_scroll_pagination.

zefaxet avatar zefaxet commented on July 26, 2024

Not quite. Example:
Let's say you create the exemplar PagingController hooked up to the Article repository (referencing your guide here), but instead you give the controller firstPageKey: 2. When you scroll down, you end up dispatching requests for page 3, 4, 5, etc...

What @valerybodak is asking for is, if they were to scroll up in this case, for the controller to dispatch a request for page 1 and prepend it to the top of the scroll view (preserving order).

You're right that the package I linked is not paginating anything, but it is not circular. Is is able to generate indices infinitely in both directions, up or down, allowing you to have infinite scroll in both directions with fresh items. I think this concept can be extended to your implementation of the PagingController. I'm new to Dart so I might have missed some semantics, but I think at a high level all you need to do is add a new key boundary for the controller to keep track of the top of the page results as well as the bottom (what it does now). Then you should be able to invoke a prepending analogy to the existing appendPage.

Perhaps:

void prependPage(List<ItemType> newItems, PageKeyType nextReversePageKey) {
  ...
}

Can't figure out a better name for nextReversePageKey so I hope my explanation clears up what that's supposed to mean.

What do you think?

from infinite_scroll_pagination.

sachin052 avatar sachin052 commented on July 26, 2024

I agree with creating a new widget for this. I was going to suggest that next so it's good to see there's room for the feature if the demand comes.

It's a great Idea. I'm looking for the same

from infinite_scroll_pagination.

EdsonBueno avatar EdsonBueno commented on July 26, 2024

From now on, let's track this issue here.
I think it's better explained over there.

from infinite_scroll_pagination.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.