PagedListView | 通用列表翻页组件,快速滚动一屏,优化 ListView/GridView的滑动和滚动体验。Scroll | Grid library
kandi X-RAY | PagedListView Summary
kandi X-RAY | PagedListView Summary
Scroll ListView faster, more accurate and comfortable. 使用PageScoller可以在 中低速滑动 后会滚动一页,很慢滑动 或 很快滑动 则按默认处理。.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- scroll the page .
- Initializes the grid view .
- Callback when the view is clicked .
- Initialize the GestureDetector .
- On touch event .
- Scrolls to the view .
PagedListView Key Features
PagedListView Examples and Code Snippets
Community Discussions
Trending Discussions on PagedListView
QUESTION
I'm currently learning and converting my code to BLoc pattern. Before I'm using flutter_pagewise ^1.2.3 for my infinite scroll using Future<>
but I don't know how to use it using bloc or is it compatible with it.
So now I'm trying infinite_scroll_pagination: ^2.3.0 since it says in its docs that it supports Bloc. But I don't understand the example code in the docs for bloc. Can you give me a simple example of how to use it with bloc? I'm currently using flutter_bloc: ^6.1.3.
Here are my bloc script:
...ANSWER
Answered 2021-Jun-09 at 10:39class PaginatedList extends StatefulWidget {
const PaginatedList({Key? key}) : super(key: key);
@override
_PaginatedListState createState() => _PaginatedListState();
}
class _PaginatedListState extends State {
//*bloc assuming you use getIt and injectable
late final _timeLotBloc = getIt();
List records = [];
//*initialize page controller
final PagingController _pagingController =
PagingController(firstPageKey: 0);
@override
void initState() {
super.initState();
//*so at event add list of records
_pagingController.addPageRequestListener(
(pageKey) => _timeLotBloc
.add(GetTimeslotViewEvent(records: records, offset: pageKey,limit: 10)),
);
}
@override
void dispose() {
super.dispose();
_timeLotBloc.close();
_pagingController.dispose();
}
@override
Widget build(BuildContext context) {
return BlocProvider(
create: (context) => _timeLotBloc,
child: BlocListener(
listener: (context, state) {
if (state is TimeslotViewLoadedState) {
records =state.records;
//forget about existing record
//about the last page, fetch last page number from
//backend
int lastPage = state.lastPage
final _next = 1 + records.length;
if(_next>lastPage){
_pagingController.appendLastPage(records);
}
else{
_pagingController.appendPage(records, _next);
}
}
if (state is TimeslotViewErrorState) {
_pagingController.error = state.error;
}
},child: BlocBuilder(
builder: (context,state)=> PagedListView(
pagingController: _pagingController,
builderDelegate: PagedChildBuilderDelegate(
itemBuilder: (context, time, index) => TimeslotViewEntityListItem(
character: time,
),
),
),),
),
);
}
}
QUESTION
It's been a long time since I started to search for a Flutter ListView library that will allow me to use pagination in a smart way. Sadly I haven't found anything that meets my criteria:
- Smart pagination: the library should't simply increase a list page-by-page but must have a fixed size cache which load and keep in memory only the needed pages in the moment.
- Async loading: the library should basically accept a function which returns a future of a list representing a page.
- Real-time invalidation: Dart has streams, so somehow the library should use their power to handle invalidation and reload everything needed when data changes in a reactive way.
Basically I wanted something that acted like PagedListAdapter + DataSource.Factory + LiveData in the standard Android library. I came up with the widget PagedListView:
...ANSWER
Answered 2020-Feb-24 at 09:01This is the last version thanks to some very useful suggestions
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install PagedListView
You can use PagedListView like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the PagedListView component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page