paging 0.0.9
paging: ^0.0.9 copied to clipboard

Flutter Android iOS web

A Flutter package for paginating a list view from network or local storage

example/README.md

example #

Example for paging library

import 'package:flutter/material.dart';
import 'package:paging/paging.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.red,
      ),
      home: MyHomePage(title: 'Paging Example'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  static const int _COUNT = 10;

  // 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(widget.title)),
      body: Pagination(
        pageBuilder: (currentListSize) => pageData(currentListSize),
        itemBuilder: (item) => ListTile(title: Text(item)),
      ),
    );
  }
}
16
likes
100
pub points
85%
popularity

A Flutter package for paginating a list view from network or local storage

Repository (GitHub)
View/report issues

Documentation

API reference

Uploader

joshuamatta1996@gmail.com

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on paging