You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ansu_ui/lib/refresh/as_refresh.dart

49 lines
1.3 KiB

4 years ago
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:ansu_ui/styles/as_colors.dart';
class ASRefresh extends StatefulWidget {
final Widget child;
final Future Function() onLoad;
final Future Function() onRefresh;
final EasyRefreshController controller;
4 years ago
final bool firstRefresh;
final Widget emptyWidget;
final Widget firstRefreshWidget;
ASRefresh({
Key key,
@required this.child,
this.onLoad,
this.onRefresh,
this.controller,
4 years ago
this.firstRefresh = true,
this.emptyWidget,
this.firstRefreshWidget,
}) : super(key: key);
@override
_ASRefreshState createState() => _ASRefreshState();
}
class _ASRefreshState extends State<ASRefresh> {
@override
Widget build(BuildContext context) {
return EasyRefresh(
child: widget.child,
onRefresh: widget.onRefresh,
onLoad: widget.onLoad,
controller: widget.controller,
4 years ago
firstRefresh: widget.firstRefresh,
emptyWidget: widget.emptyWidget,
firstRefreshWidget: widget.firstRefreshWidget,
header: MaterialHeader(
valueColor: AlwaysStoppedAnimation(kPrimaryColor),
),
footer: MaterialFooter(
enableInfiniteLoad: false,
valueColor: AlwaysStoppedAnimation(kPrimaryColor),
),
);
}
}