29 lines
678 B
Dart
29 lines
678 B
Dart
import 'package:easy_refresh/easy_refresh.dart';
|
|
import 'package:flutter/widgets.dart';
|
|
|
|
typedef RefreshAction = Future<void> Function();
|
|
|
|
/// Shared pull-to-refresh and load-more wrapper for future list features.
|
|
class AppRefresh extends StatelessWidget {
|
|
const AppRefresh({
|
|
super.key,
|
|
required this.child,
|
|
this.onRefresh,
|
|
this.onLoad,
|
|
this.controller,
|
|
});
|
|
|
|
final Widget child;
|
|
final RefreshAction? onRefresh;
|
|
final RefreshAction? onLoad;
|
|
final EasyRefreshController? controller;
|
|
|
|
@override
|
|
Widget build(BuildContext context) => EasyRefresh(
|
|
controller: controller,
|
|
onRefresh: onRefresh,
|
|
onLoad: onLoad,
|
|
child: child,
|
|
);
|
|
}
|