Giter Site home page Giter Site logo

maikub / incrementally_loading_listview Goto Github PK

View Code? Open in Web Editor NEW
179.0 179.0 39.0 146 KB

An extension of the Flutter ListView widget for incrementally loading items upon scrolling

License: BSD 3-Clause "New" or "Revised" License

Objective-C 0.22% Dart 74.17% Kotlin 2.64% Ruby 20.55% Swift 2.42%
flutter flutter-package flutter-widget widget

incrementally_loading_listview's People

Contributors

abhijeethp avatar avdosev avatar maikub avatar msal4 avatar tkeithblack avatar wemped avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

incrementally_loading_listview's Issues

Positional insert / updates

I need to update rows in the list as new rows pushed to the app.
But I need to not just add them at the bottom but rather in any previous location that I scrolled past.

The ops would be:
Insert
Update
Delete.

Thinking about how best to extend the code to support this.

The data coming in must know it's position. This is a sequence key unique to each table.

  1. Just buffer all data on the client and so do the insert / update / delete into the buffer. The list then just reads from the buffer as the user scrolls up and down. This keeps the logic away from the list

  2. Maybe you have an idea on another approach

use in futurebuilder

Merhaba,
futurebuilder içinde "IncrementallyLoadingListView" kullanıyorum.
Fakata future sürekli çalışmaya devam ediyor.
Bunun için ne yapabilirim.
futuru: api_post
Here information comes from the service and makes hundreds of requests per second.

equivalent incrementally_loading_listview for Slivers

Currently this library is not compatible w/ Slivers. Slivers are used often when you have complex scrolling views or even just a scrolling app bar.

I think it would be awesome to create a similar incrementally_loading_listview but for usages in Slivers. That way this library can be used in even more scenarios.

Loading indicator widget

Hi,

thanks for the great library! Is it possible to specify the loading indicator widget somehow (in a RefreshIndicator fashion or any custom widget)? That would be really useful to display at the bottom of the list, while data is loading.

Loading callbacks not firing when inside FutureBuilder

I have a somewhat weird issue around loading indicators and this widget. In one part of my app, I load a rather sizable list from the server, so I display a loading indicator using a FutureBuilder<http.Response>, so that the app shows something while the fetch is underway, then switch to this ListView once I have the data. This is the code in question:

FutureBuilder<http.Response>(
  future: _initialGet, // set to a Future in the `initState()` method
  builder: (BuildContext context, AsyncSnapshot<http.Response> snapshot) {
    if (snapshot.hasData) {
      http.Response response = snapshot.data;
      print(response.statusCode);
      SearchResults results = SearchResults.fromBuffer(response.bodyBytes);
      _cursor = results.cursor;
      _hasMore = results.hasMore;
      _updateList(results.sites); // this method updates the `_items` list used below

      return Container(
        key: Key("generalList"),
        child: IncrementallyLoadingListView(
          key: ValueKey(_items),
          shrinkWrap: false,
          itemCount: () => _items.length,
          hasMore: () => _hasMore,
          loadMoreOffsetFromBottom: 5,
          itemBuilder: (context, index) {
            // create tile
          },
          loadMore: () async {
            // load more stuff
          },
        ),
      );
    } else if (snapshot.hasError) {
      // Only for debug and testing really
      return Container(
        key: Key("generalList"),
        child: Text("${snapshot.data.statusCode}"),
      );
    } else {
      // Loading indicator
      return Column(
        mainAxisAlignment: MainAxisAlignment.center,
        children: <Widget>[
          SizedBox(
            child: CircularProgressIndicator(),
            width: 60,
            height: 60,
          ),
          const Padding(
            padding: EdgeInsets.only(top: 16),
            child: Text('Loading...'),
          )
        ],
      );
    }
  },
)

The loading indicator appears and disappears, the list is created, and has all the items I loaded. However, the callbacks, namely loadMore don't seem to fire when the end of the list is reached - a breakpoint set in that function is never hit. The same does not happen when outside the FutureBuilder.

Is it possible the FutureBuilder is somehow interfering with detecting the end of the list?

[Feature proposal] Conserve scroll momentum

This is probably hard to do, but it would be very nice if you could scroll down in one big motion, stopping until hitting the last fetched entry, and then continuing to scroll down (maybe less quickly) after the remaining content has been fetched.

I am not 100% sure how that would feel like, so I would like to have a bit of an discussion, has anyone ever seen that behaviour in another app?

Performance question

I can't test it out right now and am just looking for useful resources/libraries for my current project.

I am curious on how it performs with huge sets of data. Does it allocate and keep every newly generated list entry in memory? Not sure if you are familiar with the android ecosystem, but there is a component called RecyclerView that basically re-uses the UI elements and only changes the data that they display, making it super memory efficient and reduces the lag created by allocating all UI elements and keeping them alive.

Thanks!

SQFLite Implementation

Is this package also fit to SQFlite data fetching ?

In my case, I may have thousands of transaction records, which clearly are not required to pop all at once.

What's your opinion ?

Thanks

Rxdart conflict

When I try to install the 0.04 version of the package in pubspec.yaml, I get this error:

Because flutter_google_places >=0.1.3 depends on rxdart ^0.19.0 and incrementally_loading_listview >=0.0.4 depends on rxdart ^0.18.1, flutter_google_places >=0.1.3 is incompatible with incrementally_loading_listview >=0.0.4.
So, because my_project depends on both incrementally_loading_listview ^0.0.4+3 and flutter_google_places ^0.1.3, version solving failed.

Do someone nkow how to fix it well? Thanks!

Is there anyway to remove the RxDart dependency?

I see that it uses PublishSubject. Is there any alternative for this without using RxDart? Like using StreamController perhaps?

 final PublishSubject<bool> _loadingMoreSubject = PublishSubject<bool>();
  Stream<bool> _loadingMoreStream;

  IncrementallyLoadingListViewState() {
    _loadingMoreStream =
        _loadingMoreSubject.switchMap((shouldLoadMore) => loadMore());
  }

It's just that I don't want to add RxDart to my app just for this ListView.

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.