Skip to content

Commit ed29e21

Browse files
committed
feat(LoadMore): add LoadMore widget
1 parent c1a728b commit ed29e21

File tree

2 files changed

+91
-1
lines changed

2 files changed

+91
-1
lines changed

lib/flutter_weui.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ export 'picker.dart';
88
export 'slider.dart';
99
export 'switch.dart';
1010
export 'weui_icon.dart';
11-
11+
export 'load_more.dart';

lib/load_more.dart

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
import 'package:flutter/material.dart';
2+
import 'package:flutter/cupertino.dart';
3+
4+
enum LoadType {
5+
loading,
6+
noData,
7+
dot,
8+
}
9+
10+
class LoadMore extends StatelessWidget {
11+
LoadMore({Key key, this.type = LoadType.noData}) : super(key: key);
12+
13+
final LoadType type;
14+
@override
15+
Widget build(BuildContext context) {
16+
double screenWidth = MediaQuery.of(context).size.width;
17+
return Row(
18+
mainAxisAlignment: MainAxisAlignment.center,
19+
crossAxisAlignment: CrossAxisAlignment.center,
20+
children: <Widget>[
21+
Container(
22+
width: screenWidth * 0.65,
23+
margin: const EdgeInsets.symmetric(vertical: 15),
24+
child: Row(
25+
children: <Widget>[
26+
Expanded(
27+
child: Divider(
28+
height: 1,
29+
)),
30+
Padding(
31+
padding: const EdgeInsets.symmetric(horizontal: 5),
32+
child: Row(
33+
children: <Widget>[
34+
Offstage(
35+
child: CupertinoActivityIndicator(),
36+
offstage: type != LoadType.loading,
37+
),
38+
type == LoadType.dot
39+
? Container(
40+
width: 4,
41+
height: 4,
42+
child: Text(""),
43+
decoration: BoxDecoration(
44+
color: Color(0xFFE5E5E5),
45+
borderRadius: BorderRadius.all(Radius.circular(2))
46+
),
47+
)
48+
: Text(type == LoadType.loading ? "正在加载" : "暂无数据",style: TextStyle(fontSize: 14),),
49+
],
50+
),
51+
),
52+
Expanded(
53+
child: Divider(
54+
height: 1,
55+
)),
56+
],
57+
),
58+
)
59+
],
60+
);
61+
// TODO: implement build
62+
return Container(
63+
child: Row(
64+
crossAxisAlignment: CrossAxisAlignment.center,
65+
children: <Widget>[
66+
Expanded(
67+
child: Text(""),
68+
flex: 4,
69+
),
70+
Expanded(
71+
flex: 12,
72+
child: Row(
73+
children: <Widget>[
74+
Expanded(child: Divider()),
75+
Row(
76+
children: <Widget>[CupertinoActivityIndicator(), Text("正在加载")],
77+
),
78+
Expanded(child: Divider()),
79+
],
80+
),
81+
),
82+
Expanded(
83+
child: Text(""),
84+
flex: 4,
85+
)
86+
],
87+
),
88+
);
89+
}
90+
}

0 commit comments

Comments
 (0)