refresher 0.0.1+1 copy "refresher: ^0.0.1+1" to clipboard
refresher: ^0.0.1+1 copied to clipboard

outdated

Customize Pull to Refresh Widget

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.1+1

Example #

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

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

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

  double percentage = 0.0;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        // Here we take the value from the MyHomePage object that was created by
        // the App.build method, and use it to set our appbar title.
        title: Text(_title),
      ),
      body: Refresher(
        onRefresh: () async {
          int counter = 0;
          Timer.periodic(Duration(milliseconds: 1000), (t) {
            counter++;
            setState(() {
              _title = "Fetching${List.filled(counter, ".").join()}";
              if (counter == 5) t.cancel();
            });
          });
          await Future.delayed(new Duration(milliseconds: 6000));
          setState(() { _title = "Refresher Demo";
          });
        },
        child: Column(
            children: List.generate(
          100,
          (index) => Text("Here is $index"),
        )),
      ),
    );
  }
}
1
likes
0
pub points
0%
popularity

Publisher

unverified uploader

Customize Pull to Refresh Widget

Homepage

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on refresher