maikub / incrementally_loading_listview Goto Github PK
View Code? Open in Web Editor NEWAn extension of the Flutter ListView widget for incrementally loading items upon scrolling
License: BSD 3-Clause "New" or "Revised" License
An extension of the Flutter ListView widget for incrementally loading items upon scrolling
License: BSD 3-Clause "New" or "Revised" License
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.
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
Maybe you have an idea on another approach
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.
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.
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.
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?
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?
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!
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
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!
It will better to spilt the listview and your auto load more widget.
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.