Install easy_refresh_bubbles
v3To use the Bubbles indicator with EasyRefresh, add both easy_refresh and easy_refresh_bubbles to your Flutter project's dependencies.
dependencies:
flutter_easy_refresh: version
easy_refresh_bubbles: versionrepository·v3·Indexed 26 days ago
https://github.com/xuelongqy/flutter_easy_refreshA pull-to-refresh framework for Flutter supporting pull-down refresh and pull-up load for most Scrollable widgets. It features highly customizable headers and footers, including specialized animation styles like Bow, Bubbles, Halloween, Skating, Space, and Squats. The framework includes EasyRefreshController for manual state control and a companion package, easy_paging, for automatic pagination integration via the EasyPaging widget and EasyPagingState.
To use the Bubbles indicator with EasyRefresh, add both easy_refresh and easy_refresh_bubbles to your Flutter project's dependencies.
dependencies:
flutter_easy_refresh: version
easy_refresh_bubbles: versionFor handling pagination logic alongside easy_refresh, use the companion package easy_paging.
import 'package:easy_paging/easy_paging.dart';
import 'package:easy_refresh/easy_refresh.dart';easy_paging to your Flutter project dependencies to use pagination widgets built on top of easy_refresh.To use the Halloween indicator style with EasyRefresh, add both flutter_easy_refresh and easy_refresh_halloween to your pubspec.yaml dependencies.
dependencies:
flutter_easy_refresh: version
easy_refresh_halloween: versionThe EasyPaging<DataType, ItemType> widget provides automatic integration with the EasyRefresh refresh/load lifecycle. It handles isNoMore calculations based on total or page/totalPage values.
To implement pagination, extend EasyPaging and implement its corresponding EasyPagingState.
class CustomPaging extends EasyPaging<List<String>, String> {
const CustomPaging({super.key});
@override
EasyPagingState<List<String>, String, CustomPaging> createState() =>
_CustomPagingState();
}
class _CustomPagingState
extends EasyPagingState<List<String>, String, CustomPaging> {
@override
int get count => data?.length ?? 0;
@override
String getItem(int index) => data![index];
@override
int? page;
@override
int? total;
@override
int? totalPage;
@override
Widget buildItem(BuildContext context, int index, String item) {
return ListTile(title: Text(item));
}
@override
Future onRefresh() async {
setState(() {
data = List.generate(10, (index) => 'Item $index');
total = 30;
page = 1;
});
}
@override
Future onLoad() async {
final nextPage = page! + 1;
setState(() {
data!.addAll(List.generate(10, (index) => 'Item ${data!.length + index}'));
page = nextPage;
});
}
}Pagination logic has been moved to a separate package called easy_paging. To use it, add easy_paging to your dependencies and import it alongside easy_refresh.
import 'package:easy_paging/easy_paging.dart';
import 'package:easy_refresh/easy_refresh.dart';To use the Squats indicator animations, add both flutter_easy_refresh and easy_refresh_squats to your Flutter project's dependencies.
dependencies:
flutter_easy_refresh: version
easy_refresh_squats: versionTo use the Bow indicator style, add both easy_refresh and easy_refresh_bow to your project's dependencies in pubspec.yaml.
dependencies:
easy_refresh: version
easy_refresh_bow: versionTo use the Space Indicator (SpaceHeader and SpaceFooter) with EasyRefresh, add both flutter_easy_refresh and easy_refresh_space to your pubspec.yaml dependencies.
dependencies:
flutter_easy_refresh: version
easy_refresh_space: versionTo use the pagination features, import both easy_paging and easy_refresh in your Dart files.
import 'package:easy_paging/easy_paging.dart';
import 'package:easy_refresh/easy_refresh.dart';To use the Skating indicator with EasyRefresh, add both flutter_easy_refresh and easy_refresh_skating to your pubspec.yaml dependencies.
dependencies:
flutter_easy_refresh: version
easy_refresh_skating: versionThe EasyRefresh widget is the primary entry point for implementing pull-down refresh and pull-up load functionality in Flutter. You can use it in two ways:
child (typically a ListView, GridView, or other ScrollView).EasyRefresh.builder and provide a childBuilder. This is recommended if you need to provide specific ScrollPhysics to your ScrollView to ensure proper interaction with the refresh indicators.Key properties:
onRefresh: A callback triggered on refresh. If null, refresh is disabled. Returns a FutureOr.onLoad: A callback triggered on load. If null, load is disabled. Returns a FutureOr.header / footer: Custom indicators for the refresh and load states.controller: An EasyRefreshController to programmatically control refresh/load states.isNested: Set to true if using EasyRefresh inside a NestedScrollView to ensure correct event triggering.