Astro Refresh Indicator

pub style: very good analysis license: MIT


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

⚙️ Getting started

Add the following lines to the pubspec.yaml:

dependencies:
  astro_refresh_indicator: ^1.0.4
  pull_to_refresh: ^2.0.0

🚀 Usage

  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 the 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

Used packages:

Used animations:

License

Licensed under the MIT License.