flutter_pagination_data 0.0.2
flutter_pagination_data: ^0.0.2 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 #
Add the latest version of package to your pubspec.yaml (and rundart pub get): dependencies: flutter_pagination_data: ^0.0.1 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'),
),
);
}
}