pdrpulm 1.0.2

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 20

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.2] - 2018-03-01

  • Specific ScrollNotification for NotificationListener
  • Add horizontal ListView demo

[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 Demo extends StatelessWidget {
  Widget build(BuildContext context) {
    return new Scaffold(
        appBar: new AppBar(title: const Text("Demo"), elevation: 0.0),
        body: new Center(child: new Text("Demo")));
  }
}

class TheList extends StatefulWidget {
  TheList({
    this.scrollDirection: Axis.vertical,
  });

  final Axis scrollDirection;
  _TheListState createState() => new _TheListState();
}

class _TheListState extends State<TheList> {
  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(
          scrollDirection: widget.scrollDirection,
          itemCount: itemCount,
          itemBuilder: (BuildContext context, int index) {
            return new InkWell(
              onTap: () {
                Navigator.of(context, rootNavigator: true).push(
                  new MaterialPageRoute<Null>(builder: (BuildContext context) {
                    return new Material(
                        child: new Scaffold(
                      appBar: new AppBar(title: new Text("")),
                      body: new TheApp(),
                    ));
                  }),
                );
              },
              child: new Ink(
                height:
                    widget.scrollDirection == Axis.horizontal ? null : 100.0,
                width: widget.scrollDirection == Axis.horizontal ? 50.0 : null,
                decoration: new BoxDecoration(
                  color: Colors.red,
                  border: new Border.all()),
                child: new Center(
                  child: new Text("$index"),
                ),
              ),
            );
          }),
    );
  }
}

class TheApp extends StatelessWidget {
  Widget build(BuildContext context) {
    // return new TheList(
    //   scrollDirection: Axis.vertical,
    // );
    return new Column(
      children: <Widget>[
        new Container(
          height: 100.0,
          child: new TheList(
            scrollDirection: Axis.horizontal,
          ),
        ),
        new Container(
          height: MediaQuery.of(context).size.height - 200,
          child: new TheList(
            scrollDirection: Axis.vertical,
          ),
        ),
      ],
    );
  }
}

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

Use this package as a library

1. Depend on it

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


dependencies:
  pdrpulm: ^1.0.2

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter packages get

Alternatively, your editor might support flutter packages 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';
  
Version Uploaded Documentation Archive
1.0.2 Mar 3, 2018 Go to the documentation of pdrpulm 1.0.2 Download pdrpulm 1.0.2 archive
1.0.1 Jan 3, 2018 Go to the documentation of pdrpulm 1.0.1 Download pdrpulm 1.0.1 archive
1.0.0 Jan 1, 2018 Go to the documentation of pdrpulm 1.0.0 Download pdrpulm 1.0.0 archive
0.0.2 Dec 9, 2017 Go to the documentation of pdrpulm 0.0.2 Download pdrpulm 0.0.2 archive
0.0.1 Dec 9, 2017 Go to the documentation of pdrpulm 0.0.1 Download pdrpulm 0.0.1 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
40
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]
20
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.

Health issues and suggestions

Fix lib/pdrpulm.dart. (-25 points)

Analysis of lib/pdrpulm.dart failed with 1 error:

line 39 col 12: The expression in an assert must be of type 'bool'.

Maintenance issues and suggestions

Add SDK constraint in pubspec.yaml. (-50 points)

For information about setting SDK constraint, please see https://www.dartlang.org/tools/pub/pubspec#sdk-constraints.

Running dartdoc failed. (-10 points)

Make sure dartdoc runs without any issues.

Dependencies

Package Constraint Resolved Available
Direct dependencies
flutter 0.0.0
Transitive dependencies
collection 1.14.11
meta 1.1.6
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test