pdrpulm 1.0.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 9

pdrpulm (Pull Down to Refresh & Pull Up to Load More)

A widget that supports "Pull Down to Refresh & Pull Up to Load More" idiom. Google Material never have "Pull Up to Load More" so implement as a package.

Getting Started #

Widget build(BuildContext context) {
    return new ScrollIndicator(
        onLoadMore: onLoadMore,
        child: new ListView.builder(
            itemCount: itemCount,
            itemBuilder: (BuildContext context, int index) {
              return new Container(
                height: 150.0,
                decoration: new BoxDecoration(border: new Border.all()),
                child: new Indicator(index.toString()),
              );
            }));
  }

Roadmap #

add custom indicator when refresh or loading more

[1.0.0] - 2018-01-01

  • refactor from clean
  • remove indicator

[0.0.1] - 2017-11-01

  • copy from materials/refresh_indicator.dart
  • add load more.

example/lib/main.dart

import 'dart:async';
import 'package:flutter/material.dart';
import 'package:pdrpulm/pdrpulm.dart';

class Tank extends StatefulWidget {
  _TankState createState() => new _TankState();
}

class Indicator extends StatelessWidget {
  Indicator(this.text);

  final String text;

  Widget build(BuildContext context) {
    return new Container(
        height: 20.0,
        alignment: const Alignment(0.0, 0.0),
        child: new Text(text));
  }
}

class _TankState extends State<Tank> {
  int itemCount;

  @override
  initState() {
    super.initState();

    itemCount = 10;
  }

  Future<Null> onLoadMore() {
    final Completer<Null> completer = new Completer<Null>();
    new Timer(const Duration(microseconds: 1), () {
      completer.complete(null);
    });
    return completer.future.then((_) {
      setState(() {
        itemCount += 10;
      });
    });
  }

  Widget build(BuildContext context) {
    return new ScrollIndicator(
        onLoadMore: onLoadMore,
        child: new ListView.builder(
            itemCount: itemCount,
            itemBuilder: (BuildContext context, int index) {
              return new Container(
                height: 150.0,
                decoration: new BoxDecoration(border: new Border.all()),
                child: new Indicator(index.toString()),
              );
            }));
  }
}

void main() => runApp(new MaterialApp(
    home: new Scaffold(
        appBar: new AppBar(title: const Text("EXAMPLE FOR PDRPULM")),
        body: new Tank())));

Use this package as a library

1. Depend on it

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


dependencies:
  pdrpulm: ^1.0.1

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:pdrpulm/pdrpulm.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
18
Health:
Code health derived from static analysis. [more]
--
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
--
Overall:
Weighted score of the above. [more]
9
Learn more about scoring.

The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.

Analysis issues and suggestions

Support Dart 2 in pubspec.yaml.

The SDK constraint in pubspec.yaml doesn't allow the Dart 2.0.0 release. For information about upgrading it to be Dart 2 compatible, please see https://dart.dev/dart-2#migration.

Maintenance issues and suggestions

Make sure dartdoc successfully runs on your package's source files. (-10 points)

Dependencies were not resolved.