A Flutter package for paginating a list view

Overview

paging

A Flutter package for paginating a list view

pub package

Installation

Add this to your package's pubspec.yaml file

dependencies:
  ...
  paging: ^latest.version.here

Usage

First import paging.dart

  import 'package:paging/paging.dart';

Simple to use. You can pass a type <T> as a parameter to the widget, by default dynamic is assumed.

There are two required parameters:

  • pageBuilder: requires a Future of List<T> and gives you the current size of list
  • itemBuilder: requires a widget and gives you the item of type <T> to be displayed
  // mocking a network call
  Future<List<String>> pageData(int previousCount) async {
    await Future.delayed(Duration(seconds: 0, milliseconds: 2000));
    List<String> dummyList = List();
    if (previousCount < 30) {
      // stop loading after 30 items
      for (int i = previousCount; i < previousCount + _COUNT; i++) {
        dummyList.add('Item $i');
      }
    }
    return dummyList;
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text('Pagination List')),
      body: Pagination<String>(
        pageBuilder: (currentSize) => pageData(currentSize),
        itemBuilder: (index, item){
          return Container(
                    color: Colors.yellow,
                    height: 48,
                    child: Text(item),
                 );
        },
      ),
    );
  }

Screenshots

Getting Started

This project is a starting point for a Dart package, a library module containing code that can be shared easily across multiple Flutter or Dart projects.

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

You might also like...

Responsive Scaffold - On mobile it shows a list and pushes to details and on tablet it shows the List and the selected item. Maintainer: @rodydavis

Responsive Scaffold - On mobile it shows a list and pushes to details and on tablet it shows the List and the selected item. Maintainer: @rodydavis

responsive_scaffold View the online demo here! On mobile it shows a list and pushes to details and on tablet it shows the List and the selected item.

Dec 2, 2022

Csv to list for web - Convert a CSV into a list in order to populate a firebase database

Csv to list for web - Convert a CSV into a list in order to populate a firebase database

My goal is to convert a CSV into a list in order to populate a firebase database

Jan 26, 2022

Horizontal list - A horizontal list widget to use in mainly for web or desktop application

Horizontal list - A horizontal list widget to use in mainly for web or desktop application

horizontal_list A horizontal list widget with buttons next and previous. You can

Feb 2, 2022

Flutter agenda - Flutter Agenda View Package (pub.dev)

Flutter agenda - Flutter Agenda View Package (pub.dev)

Flutter Agenda View Agenda Widget Package for Flutter Features Image Video Recor

Apr 15, 2022

A fork/modification of flutter epub view package

A fork/modification of flutter epub view package

epub_view Pure flutter widget for view EPUB documents on all platforms. Based on epub package. Render with flutter widgets (not native view) on any pl

Dec 28, 2021

A Flutter package for iOS and Android for picking last seven dates and time with analog view.

analog_time_picker package for Flutter A Flutter package for iOS and Android for picking last seven dates and time with analog view. Demo Installation

Aug 31, 2021

Flutter package for displaying grid view of daily task like Github-Contributions.

Flutter package for displaying grid view of daily task like Github-Contributions.

flutter_annual_task flutter_annual_task Flutter package for displaying grid view of daily task like Github-Contributions. Example Usage Make sure to c

Sep 21, 2022

A Flutter package which provides 360 view of the images with rotation and gesture customisations.

 A Flutter package which provides 360 view of the images with rotation and gesture customisations.

imageview360 A Flutter package which provides 360 view of the images with rotation and gesture customisations. Supported Dart Versions Dart SDK versio

Dec 1, 2022

Flutter package for Android and iOS allow you to show a wide range of hyperlinks either in the input field or in an article view

Flutter package for Android and iOS allow you to show a wide range of hyperlinks either in the input field or in an article view

Tagtly package help you to detect a lot of hyperlink text such as.. email, url, social media tags, hashtag and more either when user type in text field or when appear a text read only.

Jul 25, 2022
Comments
  • It doesn't reload after setState called.

    It doesn't reload after setState called.

    I need filters inside my page and when the filtered response came, I do the setState on data that should be reloaded and changed but nothing happened.

    opened by Nastya-Scherbakova 3
  • pullToRefresh not working with paging widget

    pullToRefresh not working with paging widget

    Is there a convenient way to wrap this inside a SmartRefresher (pull_to_refresh) to enable a pull-to-refresh feature?

    I tried wrapping the pagination widget inside a SmartRefresh widget, but it is not recognizing it or working.

    opened by am-singh 2
Owner
Joshua Matta
IITD. Android, iOS and Flutter enthusiast.
Joshua Matta
Flutter package to create list of radio button, by providing a list of objects it can be a String list or list of Map.

Custom Radio Group List Flutter package to create list of radio button, by providing a list of objects it can be a String list or list of Map. Feature

Ashok Kumar Verma 0 Nov 30, 2021
Grid-View-App - Grid View App For Flutter

grid_view_app practice purpose flutter application Getting Started This project

Md Tarequl Islam 4 Jun 9, 2022
Swipeable button view - Create Ripple Animated Pages With Swipeable Button View

swipeable_button_view You can create ripple animated pages with swipeable_button

cemreonur 3 Apr 22, 2022
-UNDER DEVELOPMENT- a project built demonstrating model view view model architecture

mvvm_project A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if

Atuoha Anthony 4 Nov 28, 2022
A flutter list view which can drag & move item to change order.

draggable_flutter_list A flutter list view which can drag & move item to change order. some codes come from flutter_list_drag_and_drop fix flutter_lis

刘彦博 40 Sep 22, 2022
A section list view for flutter

Section view Features Show with select view Alphabet support Refresh support Scr

null 6 Nov 6, 2022
Multi type list view - A flutter customer ListView that displays multiple widget types.

MultiTypeListView A light weight flutter customer ListView that displays multiple widget types. Screenshot home chat Getting Started dependencies: m

齐翊(学义) 52 Jun 28, 2022
Ali Türkay AVCI 1 Jan 20, 2022
A Flutter based to do list app (yes, another to do list... but... this time based on a beautiful design)

✔️ Flutter to do App "To Do List" A Flutter app based on the design of the To Do App, created by Rudi Hartono, see more on: Uplabs. Getting Started ??

Johan 561 Dec 31, 2022
Product List Digikala - A List Of Product Digikala App With Flutter

Product List Digikala This is a Mini-Project For Digikala App With Flutter By Mi

Dively_HP 4 Jan 7, 2023