refresher 0.0.4

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

Refresher #

My custom Pull to Refresh Widget, mimicking iOS Pull to Refresh except for the toolbar

Installation #

First, add refresher as a dependency in your pubspec.yaml file.

refresher: ^0.0.4

Example #

class RefresherDemo extends StatefulWidget {
  @override
  _RefresherDemoState createState() => _RefresherDemoState();
}

class _RefresherDemoState extends State<RefresherDemo> with SingleTickerProviderStateMixin {
  String _title = "Refresher Demo";

  double percentage = 0.0;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text(_title), actions: [
        IconButton(
          icon: Icon(Icons.navigate_next),
          onPressed: () {
            Navigator.push(context,
                MaterialPageRoute(builder: (BuildContext context) => InfiniteRefresherDemo()));
          },
        )
      ]),
      body: Refresher(
          loadingSize: 50.0,
          margin: EdgeInsets.all(8.0),
          onRefresh: () async {
            int counter = 0;
            Timer.periodic(Duration(milliseconds: 1000), (t) {
              counter++;
              if (this.mounted)
                setState(() {
                  _title = "Fetching${List.filled(counter, ".").join()}";
                  if (counter == 5) t.cancel();
                });
            });
            await Future.delayed(new Duration(milliseconds: 6000));
            if (this.mounted)
              setState(() {
                _title = "Refresher Demo";
              });
          },
          child: Column(
              children: List.generate(
            100,
            (index) => Text("Here is $index"),
          ))),
    );
  }
}

0.0.4 #

  • Fix Android AlwaysScrollPhysics clamping problem.

0.0.3+2 #

  • Disable Refresh when doing Fetch More Data and vice versa.

0.0.3+1 #

  • Add new reset function without fetch new data (because it's handled at the front).

0.0.3 #

  • Add Refresher combined with InfiniteListView (InfiniteRefresher).

0.0.2 #

  • Add margin and loading size to argument, also scrollController is injectable from the outside world.
  • Temporarily scroll functionality is disabled after it reaches for refresh height.

0.0.1+1 #

  • Minor bug fix.

0.0.1 #

  • Initial release.

example/README.md

import 'dart:async';

import 'package:flutter/material.dart';
import 'package:refresher/refresher.dart';
import 'package:refresher_example/infinite_demo.dart';

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

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: RefresherDemo(),
    );
  }
}

class RefresherDemo extends StatefulWidget {
  @override
  _RefresherDemoState createState() => _RefresherDemoState();
}

class _RefresherDemoState extends State<RefresherDemo> with SingleTickerProviderStateMixin {
  String _title = "Refresher Demo";

  double percentage = 0.0;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text(_title), actions: [
        IconButton(
          icon: Icon(Icons.navigate_next),
          onPressed: () {
            Navigator.push(context,
                MaterialPageRoute(builder: (BuildContext context) => InfiniteRefresherDemo()));
          },
        )
      ]),
      body: Refresher(
          loadingSize: 50.0,
          margin: EdgeInsets.all(8.0),
          onRefresh: () async {
            int counter = 0;
            Timer.periodic(Duration(milliseconds: 1000), (t) {
              counter++;
              if (this.mounted)
                setState(() {
                  _title = "Fetching${List.filled(counter, ".").join()}";
                  if (counter == 5) t.cancel();
                });
            });
            await Future.delayed(new Duration(milliseconds: 6000));
            if (this.mounted)
              setState(() {
                _title = "Refresher Demo";
              });
          },
          child: Column(
              children: List.generate(
            100,
            (index) => Text("Here is $index"),
          ))),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  refresher: ^0.0.4

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:refresher/refresher.dart';
  
Version Uploaded Documentation Archive
0.0.4 Apr 16, 2019 Go to the documentation of refresher 0.0.4 Download refresher 0.0.4 archive
0.0.3+2 Apr 13, 2019 Go to the documentation of refresher 0.0.3+2 Download refresher 0.0.3+2 archive
0.0.3+1 Apr 13, 2019 Go to the documentation of refresher 0.0.3+1 Download refresher 0.0.3+1 archive
0.0.3 Apr 13, 2019 Go to the documentation of refresher 0.0.3 Download refresher 0.0.3 archive
0.0.2 Apr 12, 2019 Go to the documentation of refresher 0.0.2 Download refresher 0.0.2 archive
0.0.1+1 Apr 10, 2019 Go to the documentation of refresher 0.0.1+1 Download refresher 0.0.1+1 archive
0.0.1 Apr 10, 2019 Go to the documentation of refresher 0.0.1 Download refresher 0.0.1 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
39
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
70
Overall:
Weighted score of the above. [more]
63
Learn more about scoring.

We analyzed this package on Apr 22, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.2.0
  • pana: 0.12.14
  • Flutter: 1.4.7

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Format lib/always_bouncing_physics.dart.

Run flutter format to format lib/always_bouncing_physics.dart.

Format lib/infinite_list_view.dart.

Run flutter format to format lib/infinite_list_view.dart.

Format lib/loading_animation.dart.

Run flutter format to format lib/loading_animation.dart.

Fix additional 4 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/not_bouncing_physics.dart (Run flutter format to format lib/not_bouncing_physics.dart.)
  • lib/refresh_indicator_physics.dart (Run flutter format to format lib/refresh_indicator_physics.dart.)
  • lib/refresher.dart (Run flutter format to format lib/refresher.dart.)
  • lib/refresher_infinite.dart (Run flutter format to format lib/refresher_infinite.dart.)

Maintenance suggestions

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.68.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11
meta 1.1.6 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8