Space Indicator on EasyRefresh.

License Pub

Online demo

Animation from Flare-Flutter

Features

SpaceHeader and SpaceFooter.

Getting started

Requires Flutter >=3.47 and Dart ^3.13.

dependencies:
  flutter:
    sdk: flutter
  easy_refresh: ^4.0.0
  easy_refresh_space: ^2.0.0
  material_ui: ^1.5.0
  rive: ^0.14.11

Usage

Initialize Rive before runApp. Assets are bundled with the package; no app asset declarations are needed. These indicators support vertical scrolling.

import 'package:easy_refresh/easy_refresh.dart';
import 'package:easy_refresh_space/easy_refresh_space.dart';
import 'package:material_ui/material_ui.dart';
import 'package:rive/rive.dart' show RiveNative;

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await RiveNative.init();
  runApp(const MaterialApp(home: StyleExample()));
}

class StyleExample extends StatefulWidget {
  const StyleExample({super.key});

  @override
  State<StyleExample> createState() => _StyleExampleState();
}

class _StyleExampleState extends State<StyleExample> {
  int _count = 30;

  @override
  Widget build(BuildContext context) => Scaffold(
    appBar: AppBar(title: const Text('Space indicators')),
    body: EasyRefresh(
      header: const SpaceHeader(),
      footer: const SpaceFooter(),
      onRefresh: () async {
        await Future<void>.delayed(const Duration(milliseconds: 600));
        if (!mounted) return IndicatorResult.fail;
        setState(() => _count = 30);
        return IndicatorResult.success;
      },
      onLoad: () async {
        await Future<void>.delayed(const Duration(milliseconds: 600));
        if (!mounted) return IndicatorResult.fail;
        if (_count < 90) setState(() => _count += 30);
        return _count >= 90 ? IndicatorResult.noMore : IndicatorResult.success;
      },
      child: ListView.builder(
        itemCount: _count,
        itemBuilder: (_, index) => ListTile(title: Text('Item $index')),
      ),
    ),
  );
}

AI agent skill

Usage guide covers supported parameters and limitations. Run in your app after adding the dependency:

dart run skills@ get

Libraries

easy_refresh_space