https://github.com/OpenFlutter/flutter_listview_loadmore
flutter loadmore demos
https://github.com/OpenFlutter/flutter_listview_loadmore
Last synced: 9 months ago
JSON representation
flutter loadmore demos
- Host: GitHub
- URL: https://github.com/OpenFlutter/flutter_listview_loadmore
- Owner: OpenFlutter
- License: apache-2.0
- Created: 2018-08-30T14:57:54.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-05-17T05:52:58.000Z (over 2 years ago)
- Last Synced: 2024-11-03T18:34:27.508Z (about 1 year ago)
- Language: Dart
- Homepage:
- Size: 329 KB
- Stars: 254
- Watchers: 8
- Forks: 54
- Open Issues: 23
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# loadmore
[](https://pub.dartlang.org/packages/loadmore)
[](https://github.com/OpenFlutter/flutter_listview_loadmore/tree/master/loadmore)
A loadMore library
Support `ListView` and `SliverList`
[中文构思思路和使用说明可以看简书](https://www.jianshu.com/p/abfd6f525316)
## screenshot

## whole example
show https://github.com/CaiJingLong/flutter_listview_loadmore
## install
in `pubspec.yaml`
```yaml
dependencies:
loadmore: ^2.0.1
```
import in dartfile:
```dart
import 'package:loadmore/loadmore.dart';
```
use in build:
```dart
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(
title: new Text(widget.title),
),
body: Container(
child: LoadMore(
isFinish: count >= 60,
onLoadMore: _loadMore,
child: ListView.builder(
itemBuilder: (BuildContext context, int index) {
return Container(
child: Text(list[index].toString()),
height: 40.0,
alignment: Alignment.center,
);
},
itemCount: count,
),
),
),
);
}
Future _loadMore() async {
print("onLoadMore");
await Future.delayed(Duration(seconds: 0, milliseconds: 100));
load();
return true;
}
```
properties use:
```properties
child: Widget ,required , support ListView ListView.builder ListView.separated, other is not support.
onLoadMore:required A Function , `typedef Future FutureCallBack();` , reture true is success and status delay,return false or null ,then the status will change to fail.
isFinish: bool, optional, if true, then the status will change to finish ,default is false
delegate: LoadMoreDelegate,optional, see the LoadMoreDelegate class,default is DefaultLoadMoreDelegate
textBuilder: optional, the result will show in loading view ,if you use default delegate. default is DefaultLoadMoreText.chinese,
whenEmptyLoad: bool ,optional, default is true, when [whenEmptyLoad] is true, and when listView children length is 0,or the itemCount is 0,not build loadMoreWidget.
```
```dart
abstract class LoadMoreDelegate {
const LoadMoreDelegate();
double widgetHeight(LoadMoreStatus status) => _defaultLoadMoreHeight; // the loadMore height. default is 80.0
Duration loadMoreDelay() => Duration(milliseconds: _loadMoreDelay);// When widget is created, the refresh delay time is triggered.
Widget buildChild(LoadMoreStatus status); // build your widget in the loadmore widget.
}
```
## other
homePage: https://github.com/CaiJingLong/flutter_listview_loadmore
emailto me : cjl_spy@163.com
## LICENSE
APACHE 2.0