Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/noskap/opinionated_pagination
https://github.com/noskap/opinionated_pagination
Last synced: 7 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/noskap/opinionated_pagination
- Owner: noskap
- License: bsd-3-clause
- Created: 2022-02-18T04:32:39.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-11-05T22:08:03.000Z (about 1 year ago)
- Last Synced: 2023-11-05T23:19:47.176Z (about 1 year ago)
- Language: Dart
- Size: 298 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
[![Dart](https://github.com/noskap/opinionated_pagination/actions/workflows/dart.yml/badge.svg)](https://github.com/noskap/opinionated_pagination/actions/workflows/dart.yml)
This is a pagination library that:
- manages your pagination navigation for you
- automatically calculates what page you are on, and what buttons to show
- is very lightweight and generic
- supports all Flutter platforms
- works with any state management solution
- is very opinionated## Getting started
1. Install the package: `flutter pub add opinionated_pagination`
2. Have at it## Usage
Basic example using `setState`
```dart
int paginationPage = 0;
final int limit = 5;
final int itemCount = 120;
final _pageGroupEnd = (paginationPage + 1) * limit;
final _pageGroupStart = _pageGroupEnd - (limit - 1);
var widget = OpinionatedPagination(
pageNumber: paginationPage,
totalItems: itemCount,
skip: paginationPage,
limit: limit,
onPageChanged: (int? i) {
if (i != null) {
setState(() {
paginationPage = i;
});
}
},
);
```A more fully formed example can be found on
the [example](https://pub.dev/packages/opinionated_pagination/example) page