diff --git a/assets/image/2x/chat_more.webp b/assets/image/2x/chat_more.webp new file mode 100644 index 00000000..bb796014 Binary files /dev/null and b/assets/image/2x/chat_more.webp differ diff --git a/assets/image/2x/fa_bu.webp b/assets/image/2x/fa_bu.webp index bb796014..33cc54a3 100644 Binary files a/assets/image/2x/fa_bu.webp and b/assets/image/2x/fa_bu.webp differ diff --git a/assets/image/3x/chat_more.webp b/assets/image/3x/chat_more.webp new file mode 100644 index 00000000..35fb8206 Binary files /dev/null and b/assets/image/3x/chat_more.webp differ diff --git a/assets/image/3x/fa_bu.webp b/assets/image/3x/fa_bu.webp index 35fb8206..b24c87ae 100644 Binary files a/assets/image/3x/fa_bu.webp and b/assets/image/3x/fa_bu.webp differ diff --git a/assets/image/chat_more.webp b/assets/image/chat_more.webp new file mode 100644 index 00000000..66da3c3f Binary files /dev/null and b/assets/image/chat_more.webp differ diff --git a/assets/image/fa_bu.webp b/assets/image/fa_bu.webp index 66da3c3f..0cb83711 100644 Binary files a/assets/image/fa_bu.webp and b/assets/image/fa_bu.webp differ diff --git a/lib/im/chat_details_page.dart b/lib/im/chat_details_page.dart index 049fdeb4..6ce152f0 100644 --- a/lib/im/chat_details_page.dart +++ b/lib/im/chat_details_page.dart @@ -825,7 +825,7 @@ class _ChatDetailsPage extends State child: Container( padding: EdgeInsets.only(left: 8.w, right: 19.w), child: Image.asset( - "assets/image/fa_bu.webp", + "assets/image/chat_more.webp", height: 26.h, width: 26.h, ), diff --git a/lib/im/chat_friend_group.dart b/lib/im/chat_friend_group.dart index 3bd669b4..c4d54953 100644 --- a/lib/im/chat_friend_group.dart +++ b/lib/im/chat_friend_group.dart @@ -1,5 +1,6 @@ import 'dart:ui'; +import 'package:dio/dio.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter/services.dart'; @@ -8,9 +9,12 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:flutter/cupertino.dart'; +import 'package:shared_preferences/shared_preferences.dart'; import '../../generated/l10n.dart'; import '../../utils/font_weight.dart'; import '../main.dart'; +import '../retrofit/data/base_data.dart'; +import '../retrofit/data/social_info.dart'; import '../utils/event_type.dart'; import '../view_widget/my_tab.dart'; import 'im_view/custom_underline_tabIndicator.dart'; @@ -28,12 +32,24 @@ class _ChatFriendGroup extends State ApiService apiService; TabController tabController; List _allKey = []; + SocialInfo infoNumber; @override void initState() { super.initState(); tabController = TabController(length: 3, vsync: this, initialIndex: 0); + tabController.addListener(() { + if(!tabController.indexIsChanging) + setState(() {}); + }); loadFinish(); + querySocialInfo(); + } + + @override + void dispose() { + super.dispose(); + tabController.dispose(); } loadFinish() { @@ -41,12 +57,29 @@ class _ChatFriendGroup extends State setState(() {}); } + ///个人社交信息(粉丝/关注数量/成就数量/好友数量) + querySocialInfo() async { + SharedPreferences value = await SharedPreferences.getInstance(); + apiService = ApiService(Dio(), + context: context, token: value.getString("token"), showLoading: true); + + BaseData baseData = + await apiService.socialInfo().catchError((onError) {}); + if (baseData != null && baseData.isSuccess) { + setState(() { + infoNumber = baseData.data; + }); + } + EasyLoading.dismiss(); + } + @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Color(0xFFFFFFFF), appBar: MyAppBar( - title: "${S.of(context).haoyou}(2)", + title: tabController.index == 0 ? "${S.of(context).haoyou} (${infoNumber?.mutualFollowCount ?? "0"})" : + (tabController.index == 1 ? "${S.of(context).guanzhu} (${infoNumber?.follow ?? "0"})" : "${S.of(context).fensi} (${infoNumber?.fans ?? "0"})"), titleColor: Color(0xFF0D0D0D), titleSize: 17.sp, leading: true, diff --git a/lib/im/im_view/friend_groip_list.dart b/lib/im/im_view/friend_groip_list.dart index 5acb9abb..cfdbfed8 100644 --- a/lib/im/im_view/friend_groip_list.dart +++ b/lib/im/im_view/friend_groip_list.dart @@ -95,6 +95,8 @@ class _FriendGroupList extends State { list.clear(); } list.addAll(baseData.data.list); + if(!mounted) + return; setState(() {}); } } @@ -119,18 +121,13 @@ class _FriendGroupList extends State { _refreshController.refreshFailed(); _refreshController.loadFailed(); }); - - _refreshController.refreshCompleted(); - _refreshController.loadComplete(); if (baseData != null && baseData.isSuccess) { if (pageNum == 1) { list.clear(); } list.addAll(baseData.data.list); - print("list: ${list.length}"); - if (int.tryParse(baseData.data.total) < (pageNum * 10)) { - _refreshController.loadNoData(); - } + if(!mounted) + return; setState(() {}); } } @@ -146,7 +143,8 @@ class _FriendGroupList extends State { ? NoDataView( src: "assets/image/guan_zhu.webp", isShowBtn: false, - text: "目前暂无${widget?.title ?? ""},听说多发动态可以涨粉哦~", + text: widget.title == "好友"?"目前暂无${widget?.title ?? ""}":("目前暂无${widget?.title ?? ""},${widget?.title == "粉丝" ? + "听说多发动态可以涨粉哦" :"可以在社群广场中关注自己喜欢的人哦"}~"), fontSize: 16.sp, margin: EdgeInsets.only(top: 120.h,left: 60.w,right: 60.w), ):Expanded( @@ -156,6 +154,7 @@ class _FriendGroupList extends State { shrinkWrap: true, itemBuilder: (context, position) { return GestureDetector( + behavior: HitTestBehavior.opaque, onTap:(){ Navigator.of(context).pushNamed( '/router/chat_details_page', @@ -184,8 +183,8 @@ class _FriendGroupList extends State { child: MImage( list?.avatar ?? "", isCircle: true, - width: 66, - height: 66, + width: 66.h, + height: 66.h, fit: BoxFit.cover, errorSrc: "assets/image/default_user.webp", fadeSrc: "assets/image/default_user.webp", diff --git a/lib/im/im_view/im_page.dart b/lib/im/im_view/im_page.dart index 12ccec6e..235b4ada 100644 --- a/lib/im/im_view/im_page.dart +++ b/lib/im/im_view/im_page.dart @@ -229,7 +229,9 @@ class _IMPage extends State implements OnChatMessage { behavior: HitTestBehavior.opaque, onTap: () { Navigator.of(context) - .pushNamed('/router/chat_friend_group'); + .pushNamed('/router/chat_friend_group').then((value) { + _refresh(); + }); }, child: Container( padding: EdgeInsets.all(12), diff --git a/lib/retrofit/data/social_info.dart b/lib/retrofit/data/social_info.dart index cffbc3d4..184c1e54 100644 --- a/lib/retrofit/data/social_info.dart +++ b/lib/retrofit/data/social_info.dart @@ -5,24 +5,29 @@ class SocialInfo { SocialInfo({ dynamic fans, dynamic follow, - dynamic achievementNumber}){ + dynamic achievementNumber, + dynamic mutualFollowCount}){ _fans = fans; _follow = follow; _achievementNumber = achievementNumber; + _mutualFollowCount = mutualFollowCount; } SocialInfo.fromJson(dynamic json) { _fans = json['fans']; _follow = json['follow']; _achievementNumber = json['achievementNumber']; + _mutualFollowCount = json['mutualFollowCount']; } dynamic _fans; dynamic _follow; dynamic _achievementNumber; + dynamic _mutualFollowCount; dynamic get fans => _fans; dynamic get follow => _follow; dynamic get achievementNumber => _achievementNumber; + dynamic get mutualFollowCount => _mutualFollowCount; set fans(int value) { @@ -34,6 +39,7 @@ class SocialInfo { map['fans'] = _fans; map['follow'] = _follow; map['achievementNumber'] = _achievementNumber; + map['mutualFollowCount'] = _mutualFollowCount; return map; } @@ -44,4 +50,8 @@ class SocialInfo { set achievementNumber(int value) { _achievementNumber = value; } + + set mutualFollowCount(int value) { + _mutualFollowCount = value; + } } \ No newline at end of file diff --git a/lib/retrofit/retrofit_api.dart b/lib/retrofit/retrofit_api.dart index 7cbe6f65..970d44c0 100644 --- a/lib/retrofit/retrofit_api.dart +++ b/lib/retrofit/retrofit_api.dart @@ -458,7 +458,7 @@ abstract class ApiService { @DELETE("/information/trend/{id}") Future deleteTrend(@Path("id") String id); - ///个人社交信息(粉丝/关注数量/成就数量) + ///个人社交信息(粉丝/关注数量/成就数量/好友数量) @GET("/member/socialInfo") Future> socialInfo();