pagination_view 0.7.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 83

PaginationView #

pub package

Installing #

In your pubspec.yaml

dependencies:
  pagination_view: ^0.7.0
import 'package:pagination_view/pagination_view.dart';

Basic Usage #

    PaginationView<User>(
      itemBuilder: (BuildContext context, User user) => ListTile(
        title: Text(user.name),
        subtitle: Text(user.email),
        leading: IconButton(
          icon: Icon(Icons.person),
          onPressed: () => null,
        ),
      ),
      pageFetch: pageFetch,
      onError: (dynamic error) => Center(
        child: Text('Some error occured'),
      ),
      onEmpty: Center(
        child: Text('Sorry! This is empty'),
      ),
    );

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.

License #

This project is licensed under the MIT License - see the LICENSE file for details

[0.1.0] - 2020-01-06 #

  • Initial release

[0.2.0] - 2020-01-06 #

  • Change in Example and Description

[0.3.0] - 2020-01-22 #

  • Now you can preload list view with initialData

[0.4.0] - 2020-01-27 #

  • Added necessary ListView attributes like shrinkWrap, physics, etc.,

[0.5.0] - 2020-02-03 #

  • Fixed NoSuchMethodError

[0.6.0] - 2020-03-08 #

  • Added reverse attribute

[0.7.0] - 2020-03-13 #

  • Added Refresh Indicator which can be enabled by onRefresh property

example/lib/main.dart

import 'package:example/user.dart';
import 'package:faker/faker.dart';
import 'package:flutter/material.dart';
import 'package:pagination_view/pagination_view.dart';

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: HomePage(),
    );
  }
}

class HomePage extends StatelessWidget {
  const HomePage({Key key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text('PaginationView Example')),
      body: PaginationView<User>(
        itemBuilder: (BuildContext context, User user) {
          return ListTile(
            title: Text(user.name),
            subtitle: Text(user.email),
            leading: IconButton(
              icon: Icon(Icons.person),
              onPressed: () => null,
            ),
          );
        },
        pageFetch: pageFetch,
        onError: (dynamic error) => Center(
          child: Text('Some error occured'),
        ),
        initialData: <User>[
          User(faker.person.name(), faker.internet.email()),
          User(faker.person.name(), faker.internet.email()),
        ],
        onEmpty: Center(
          child: Text('Sorry! This is empty'),
        ),
      ),
    );
  }

  Future<List<User>> pageFetch(int offset) async {
    final Faker faker = Faker();
    final List<User> nextUsersList = List.generate(
        10, (int index) => User(faker.person.name(), faker.internet.email()));
    await Future<List<User>>.delayed(Duration(seconds: 2));
    return nextUsersList;
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  pagination_view: ^0.7.0

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support 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:pagination_view/pagination_view.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
66
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
83
Learn more about scoring.

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

  • Dart: 2.7.1
  • pana: 0.13.6
  • Flutter: 1.12.13+hotfix.8

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.2.2 <3.0.0
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