flutter_pagination_data 0.0.4
flutter_pagination_data: ^0.0.4 copied to clipboard
pagination package
This package helps in the bagging process when receiving data from the Internet, reduces the number of requests, and get data that fits on one page.
Features #
A Pagination Library for Flutter (with Web Support).
Installation #
To install flutter_pagination_data, add the following line to your pubspec.yaml file:
dependencies:
flutter_pagination_data: ^0.0.4
Import the package and use it in your Flutter App.
import 'package:flutter_pagination_data/flutter_pagination_data.dart';
## Usage
class CustomPaginationWidget extends StatelessWidget {
const CustomPaginationWidget({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return CustomPagination<NewsData>(
separatorWidget: SizedBox(
height: 10.0,
),
itemBuilder: (BuildContext context, item) {
return ListTile(
title:
Text(item.title),
subtitle: Text(item.description),
leading: IconButton(
icon: Icon(Icons.more_horiz),
onPressed: () => print(item.id),
),
onTap: () => print(item.source),
trailing: Icon(
Icons.add,
),
);
},
fetchMethod: fetchMethod,
onError: (error) => Center(
child: Text('Error'),
),
onEmpty: Center(
child: Text('Empty'),
),
);
}
}