Astro Refresh Indicator

pub package License: MIT style: very good analysis

A Flutter package that implements a RefreshIndicator. This package is meant to be used along with pull_to_refresh package.

Installation

Add the following lines to the pubspec.yaml:

dependencies:
  astro_refresh_indicator: ^1.0.0
  pull_to_refresh: ^2.0.0

Example

  final RefreshController _refreshController = RefreshController();

  Future<void> _onRefresh() async {
    await Future<void>.delayed(const Duration(milliseconds: 3000));

    _refreshController.refreshCompleted();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(),
      body: RefreshConfiguration(
        // should be greater than AstroRefreshIndicator height
        headerTriggerDistance: 155,
        child: SmartRefresher(
          header: const AstroRefreshIndicator(),
          controller: _refreshController,
          onRefresh: _onRefresh,
          child: ListView.builder(
            padding: const EdgeInsets.symmetric(vertical: 5),
            itemBuilder: (c, i) => const Card(),
            itemExtent: 200,
            itemCount: 5,
          ),
        ),
      ),
    );
  }

  @override
  void dispose() {
    _refreshController.dispose();
    super.dispose();
  }

Credits

Packages used:

Animation:

License

Licensed under the MIT License.

Libraries

astro_refresh_indicator