增加圈子下拉刷新圈子信息

This commit is contained in:
CYH 2023-07-26 14:59:40 +08:00
parent 6629751835
commit f718bec18f
3 changed files with 37 additions and 0 deletions

View File

@ -57,6 +57,16 @@ class CircleLogic extends GetxController {
showToast(bean.msg);
}
updateCircleInfo(Circle circleInfo) {
for(int i = 0; i < circle.lists.length; i++) {
Circle temp = circle.lists[i];
if (temp.id == circleInfo.id) {
circle.lists[i] = circleInfo;
break;
}
}
update();
}
setCircle(String circleId){
circle.lists.forEach((element) {

View File

@ -220,6 +220,7 @@ class _InfoListViewState extends State<InfoListView> with AutomaticKeepAliveClie
child: RefreshIndicator(
onRefresh: () async {
refreshData();
refreshCircleData();
},
child: lists.isEmpty
? !callOutMore
@ -1262,4 +1263,19 @@ class _InfoListViewState extends State<InfoListView> with AutomaticKeepAliveClie
return calculateTextHeight(
content, 14.sp, FontWeight.w300, Get.width - 64.sp, 100);
}
void refreshCircleData() async {
var routePath = Get.currentRoute;
if (routePath == AppRoutes.Signal_circle_list) return;
var data = await DioManager.instance
.get(url: 'up-service/interest/${widget.bean.id}');
if (data['code'] == 200) {
widget.bean = Circle.fromJson(data['data']);
widget.logic.updateCircleInfo(widget.bean);
setState(() {
});
}
}
}

View File

@ -67,4 +67,15 @@ class MyCircleLogic extends GetxController {
}
updateCircleInfo(Circle circleInfo) {
for(int i = 0; i < circle.lists.length; i++) {
Circle temp = circle.lists[i];
if (temp.id == circleInfo.id) {
circle.lists[i] = circleInfo;
break;
}
}
update();
}
}