The custom_loadmore
component is a convenient flutter widget that make implementation load more feature more easier, it provide a flexible and easy to use interface and can integrate with any Flutter project. This give developer focus more on another aspect when development feature also provide ability to control the layout and appearance of UI.
- Load more feature
- Layout modifies ability
- Handing build in ui function.
To use this in your project, you need follow these steps:
- In your
pubspec.yaml
file add follow codes
dependencies:
custom_loadmore: ^1.0.0
-
Run
flutter pub get
. -
Make sure import this file when use this package.
import 'package:custom_loadmore/custom_loadmore.dart'
- Create a data provider implement
ICustomLoadMoreDataProvider
interface.
class LoadmoreDataProvider implements ICustomLoadMoreDataProvider<int> {
@override
Future<List<int>?> loadMore(int pageIndex, int pageSize) async {
/// Implement load more data logic
}
}
- Provide LoadmoreDataProvider to
CustomLoadMore
widget.
Widget build(BuildContext context) { return CustomLoadMore( customLoadMoreController: controller, autoRun: widget.autoRun, loadMoreDataProvider: widget.loadMoreDataProvider, widgetBuilder: (context, state, items, controller{ /// Build your UI here } );
A longer example can be found in the /example
folder.