parent
ee90d3356b
commit
fa574ae3dc
@ -0,0 +1,28 @@
|
|||||||
|
import 'package:ansu_ui/ansu_ui.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class ExampleRefresh extends StatefulWidget {
|
||||||
|
ExampleRefresh({Key key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_ExampleRefreshState createState() => _ExampleRefreshState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _ExampleRefreshState extends State<ExampleRefresh> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return ASScaffold(
|
||||||
|
title: '刷新',
|
||||||
|
body: ASRefresh(
|
||||||
|
child: ListView.builder(
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
return Text('test');
|
||||||
|
},
|
||||||
|
itemCount: 50,
|
||||||
|
),
|
||||||
|
onRefresh: () async {},
|
||||||
|
onLoad: () async {},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,39 @@
|
|||||||
|
import 'package:ansu_ui/styles/as_colors.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_easyrefresh/easy_refresh.dart';
|
||||||
|
|
||||||
|
class ASRefresh extends StatefulWidget {
|
||||||
|
final Widget child;
|
||||||
|
final Future Function() onLoad;
|
||||||
|
final Future Function() onRefresh;
|
||||||
|
final EasyRefreshController controller;
|
||||||
|
ASRefresh({
|
||||||
|
Key key,
|
||||||
|
@required this.child,
|
||||||
|
this.onLoad,
|
||||||
|
this.onRefresh,
|
||||||
|
this.controller,
|
||||||
|
}) : 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,
|
||||||
|
header: MaterialHeader(
|
||||||
|
valueColor: AlwaysStoppedAnimation(kPrimaryColor),
|
||||||
|
),
|
||||||
|
footer: MaterialFooter(
|
||||||
|
enableInfiniteLoad: false,
|
||||||
|
valueColor: AlwaysStoppedAnimation(kPrimaryColor),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue