flutter_pagination_helper 1.0.1+2

  • Readme
  • Changelog
  • Installing
  • 82

Flutter Pagination Helper #

Flutter pagination helper is used to reduce boilerplate code for pagination.

Description #

Here we have optimised concept of Model from model-view-intent pattern as described by hannes dorfmann. So as a short note you can use this dependency for pagination by providing the state of model retrieved from your business logic. This state could be from progress bar visibility, data, error or data loading completion. Here to show paginated list you need to pass only list of widget as a data.

custom_progress default_progress

Implementation #

To add flutter pagination helper dependency add following dependency in pubspec.yaml

  flutter_pagination_helper: ^1.0.1+2

Common usage #

  • To use this dependency you have to assign PaginatedListWidget to the child of parent widget. In the code the prototype is mentioned to setup a paginated list. It can be retrived from list_helper.dart file.
  • In parameter you can optionally assign progressWidget if you need to design your custom widget as progress. You can change color for default progress by assigning colorSwatch parameter to your parent material app theme.
  • As 2nd parameter you have to assign itemListCallback which will be called each time user reach to end of listview. It can be retrived from item_list_callback.dart file.
import 'package:flutter_pagination_helper/pagination_helper/event_model.dart';
import 'package:flutter_pagination_helper/pagination_helper/item_list_callback.dart';
import 'package:flutter_pagination_helper/pagination_helper/list_helper.dart';

class CustomProgressWidget extends StatelessWidget {
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: PaginatedListWidget(
            progressWidget: Center(
              child: Text("Loading..."),
            itemListCallback: OnScrollCallback()),
  • In itemListCallback you have to implement your custom Callback as mentioned in code. It will return Future of generic type EventModel.
class OnScrollCallback<T extends Widget> extends ItemListCallback {
  Future<EventModel<T>> getItemList() {
    // TODO: implement getItemList
    return null;
  • EventModel is ui model to distinguish state as mentioned in code. It will be retrieved from event_model.dart file.
    • Here progress indicates the visibility of progress bar while loading item.
    • data will be list of widgets which will be displayed in list view. [Note : This field will contain items which are not retrieved on previous call].
    • error is a error message when api fails and it will be displayed as SnackBar.
    • stopLoading will be true when all items are retrieved and we need to stop pagination.
class EventModel<T extends Widget> {
  final bool progress;
  final List<T> data;
  final String error;
  final bool stopLoading;

  EventModel({this.progress, this.data, this.error, this.stopLoading});

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

Changelog #

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

[1.0.1+2] - 2019-01-22

Added #

  • Updated dependency and sdk version.

[1.0.0+6] - 2019-01-16

Added #

  • Update reference gifs.

[1.0.0+5] - 2019-01-15

Added #

[1.0.0+3] - 2019-01-15

Added #

[1.0.0+2] - 2019-01-15

Added #

[1.0.0+1] - 2019-01-14

Added #

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  flutter_pagination_helper: ^1.0.1+2

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:flutter_pagination_helper/example/main.dart';
import 'package:flutter_pagination_helper/pagination_helper/bloc_provider.dart';
import 'package:flutter_pagination_helper/pagination_helper/event_model.dart';
import 'package:flutter_pagination_helper/pagination_helper/item_list_callback.dart';
import 'package:flutter_pagination_helper/pagination_helper/list_helper.dart';
import 'package:flutter_pagination_helper/pagination_helper/list_widget.dart';
import 'package:flutter_pagination_helper/pagination_helper/pagination_bloc.dart';
import 'package:flutter_pagination_helper/pagination_helper/progressbar.dart';
import 'package:flutter_pagination_helper/pagination_helper/widget_list.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Jan 25, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.0
  • pana: 0.13.4
  • Flutter: 1.12.13+hotfix.5

Health suggestions

Fix lib/pagination_helper/bloc_provider.dart. (-0.50 points)

Analysis of lib/pagination_helper/bloc_provider.dart reported 1 hint:

line 18 col 44: 'ancestorWidgetOfExactType' is deprecated and shouldn't be used. Use findAncestorWidgetOfExactType instead. This feature was deprecated after v1.12.1..

Format lib/pagination_helper/widget_list.dart.

Run flutter format to format lib/pagination_helper/widget_list.dart.

Maintenance issues and suggestions

No valid SDK. (-20 points)

The analysis could not detect a valid SDK that can use this package.

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and flutter_pagination_helper.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Package is getting outdated. (-0.55 points)

The package was last published 52 weeks ago.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0-dev.9.4 <3.0.0
cupertino_icons ^0.1.2 0.1.3
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies