-
-
Notifications
You must be signed in to change notification settings - Fork 641
/
taurus.dart
62 lines (58 loc) · 1.49 KB
/
taurus.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import 'dart:async';
import 'package:example/widget/sample_list_item.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:flutter_easyrefresh/taurus_header.dart';
import 'package:flutter_easyrefresh/taurus_footer.dart';
/// 冲上云霄样式
class TaurusPage extends StatefulWidget {
@override
TaurusPageState createState() {
return TaurusPageState();
}
}
class TaurusPageState extends State<TaurusPage> {
// 总数
int _count = 20;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Taurus'),
backgroundColor: Colors.white,
),
body: EasyRefresh.custom(
header: TaurusHeader(),
footer: TaurusFooter(),
onRefresh: () async {
await Future.delayed(Duration(seconds: 2), () {
if (mounted) {
setState(() {
_count = 20;
});
}
});
},
onLoad: () async {
await Future.delayed(Duration(seconds: 2), () {
if (mounted) {
setState(() {
_count += 20;
});
}
});
},
slivers: <Widget>[
SliverList(
delegate: SliverChildBuilderDelegate(
(context, index) {
return SampleListItem();
},
childCount: _count,
),
),
],
),
);
}
}