contant_left_page.dart
4.49 KB
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/constant/state.dart';
import 'package:one_key/provider/contant_show_model.dart';
import 'package:one_key/provider/user_model.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/widgets/MyDivider.dart';
import 'package:one_key/widgets/page_exception.dart';
import 'package:one_key/widgets/v_empty_view.dart';
import 'package:provider/provider.dart';
class ContantLeftPage extends StatefulWidget {
ContantLeftPage({Key key}) : super(key: key);
@override
_ContantLeftPageState createState() => _ContantLeftPageState();
}
class _ContantLeftPageState extends State<ContantLeftPage> {
EasyRefreshController _controller;
ContantShowModel contantShowModel;
@override
void initState() {
super.initState();
_controller = EasyRefreshController();
WidgetsBinding.instance.addPostFrameCallback((_) {
_getContantData();
});
}
_getContantData() async {
Map<String, String> params = {
"sid": Provider.of<UserModel>(context, listen: false).user.sellerid,
};
await contantShowModel.getUserHistorys(context, params);
}
@override
Widget build(BuildContext context) {
contantShowModel = Provider.of<ContantShowModel>(context, listen: true);
return Consumer<ContantShowModel>(
builder: (context, model, _) {
if (model.pageStateLeft != PageState.Success) {
return ExceptionPage(
pageState: model.pageStateLeft,
callback: () {
// offset = 0;
// getMessages();
_getContantData();
},
emptyMsg: "暂时没有联系人哦",
emptyImg: "empty_search",
showMsg: "加载中,请稍后...",
);
} else {
return ListView.builder(
itemCount: model.userHistorys.length,
itemBuilder: (BuildContext context, int index) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
index == 0
? MyDivider(
double.infinity,
ScreenUtil().setWidth(20),
color: MyColours.color_f5f5f5,
)
: Container(),
Container(
width: double.infinity,
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(40),
vertical: ScreenUtil().setWidth(30)),
height: ScreenUtil().setWidth(74 * 2),
decoration: BoxDecoration(
border: Border(
top: index == 0
? BorderSide(
width: ScreenUtil().setWidth(2),
color: MyColours.color_E0E0E0)
: BorderSide(
width: 0, color: Colors.transparent),
bottom: BorderSide(
width: ScreenUtil().setWidth(2),
color: MyColours.color_E0E0E0))),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(model.userHistorys[index].rname,
style: TextStyle(
color: MyColours.color_333333,
fontSize: ScreenUtil().setSp(32))),
VEmptyView(10),
Text(model.userHistorys[index].phone,
style: TextStyle(
color: MyColours.color_999999,
fontSize: ScreenUtil().setSp(30)))
],
),
)
]);
});
// onRefresh: () async {
// // offset = 0;
// // getMessages(showLoading: false);
// },
// onLoad: () async {
// // offset++;
// // getMessages(showLoading: false);
// },
}
},
);
}
}