Browse Source

社群发布动按钮处理;

好友页面数量数据处理;
好友页面空数据显示处理;
消息页面条田对话框退出刷新列表;
好友列表标题切换数据处理;
wr_202303
wurong 4 months ago
parent
commit
3589c158d7
  1. BIN
      assets/image/2x/chat_more.webp
  2. BIN
      assets/image/2x/fa_bu.webp
  3. BIN
      assets/image/3x/chat_more.webp
  4. BIN
      assets/image/3x/fa_bu.webp
  5. BIN
      assets/image/chat_more.webp
  6. BIN
      assets/image/fa_bu.webp
  7. 2
      lib/im/chat_details_page.dart
  8. 35
      lib/im/chat_friend_group.dart
  9. 19
      lib/im/im_view/friend_groip_list.dart
  10. 4
      lib/im/im_view/im_page.dart
  11. 12
      lib/retrofit/data/social_info.dart
  12. 2
      lib/retrofit/retrofit_api.dart

BIN
assets/image/2x/chat_more.webp

Binary file not shown.

After

Width:  |  Height:  |  Size: 868 B

BIN
assets/image/2x/fa_bu.webp

Binary file not shown.

Before

Width:  |  Height:  |  Size: 868 B

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
assets/image/3x/chat_more.webp

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
assets/image/3x/fa_bu.webp

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

BIN
assets/image/chat_more.webp

Binary file not shown.

After

Width:  |  Height:  |  Size: 479 B

BIN
assets/image/fa_bu.webp

Binary file not shown.

Before

Width:  |  Height:  |  Size: 479 B

After

Width:  |  Height:  |  Size: 974 B

2
lib/im/chat_details_page.dart

@ -825,7 +825,7 @@ class _ChatDetailsPage extends State<ChatDetailsPage>
child: Container( child: Container(
padding: EdgeInsets.only(left: 8.w, right: 19.w), padding: EdgeInsets.only(left: 8.w, right: 19.w),
child: Image.asset( child: Image.asset(
"assets/image/fa_bu.webp", "assets/image/chat_more.webp",
height: 26.h, height: 26.h,
width: 26.h, width: 26.h,
), ),

35
lib/im/chat_friend_group.dart

@ -1,5 +1,6 @@
import 'dart:ui'; import 'dart:ui';
import 'package:dio/dio.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import 'package:flutter/services.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/retrofit/retrofit_api.dart';
import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:huixiang/view_widget/my_appbar.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:shared_preferences/shared_preferences.dart';
import '../../generated/l10n.dart'; import '../../generated/l10n.dart';
import '../../utils/font_weight.dart'; import '../../utils/font_weight.dart';
import '../main.dart'; import '../main.dart';
import '../retrofit/data/base_data.dart';
import '../retrofit/data/social_info.dart';
import '../utils/event_type.dart'; import '../utils/event_type.dart';
import '../view_widget/my_tab.dart'; import '../view_widget/my_tab.dart';
import 'im_view/custom_underline_tabIndicator.dart'; import 'im_view/custom_underline_tabIndicator.dart';
@ -28,12 +32,24 @@ class _ChatFriendGroup extends State<ChatFriendGroup>
ApiService apiService; ApiService apiService;
TabController tabController; TabController tabController;
List<GlobalKey> _allKey = []; List<GlobalKey> _allKey = [];
SocialInfo infoNumber;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
tabController = TabController(length: 3, vsync: this, initialIndex: 0); tabController = TabController(length: 3, vsync: this, initialIndex: 0);
tabController.addListener(() {
if(!tabController.indexIsChanging)
setState(() {});
});
loadFinish(); loadFinish();
querySocialInfo();
}
@override
void dispose() {
super.dispose();
tabController.dispose();
} }
loadFinish() { loadFinish() {
@ -41,12 +57,29 @@ class _ChatFriendGroup extends State<ChatFriendGroup>
setState(() {}); setState(() {});
} }
///(///)
querySocialInfo() async {
SharedPreferences value = await SharedPreferences.getInstance();
apiService = ApiService(Dio(),
context: context, token: value.getString("token"), showLoading: true);
BaseData<SocialInfo> baseData =
await apiService.socialInfo().catchError((onError) {});
if (baseData != null && baseData.isSuccess) {
setState(() {
infoNumber = baseData.data;
});
}
EasyLoading.dismiss();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
backgroundColor: Color(0xFFFFFFFF), backgroundColor: Color(0xFFFFFFFF),
appBar: MyAppBar( 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), titleColor: Color(0xFF0D0D0D),
titleSize: 17.sp, titleSize: 17.sp,
leading: true, leading: true,

19
lib/im/im_view/friend_groip_list.dart

@ -95,6 +95,8 @@ class _FriendGroupList extends State<FriendGroupList> {
list.clear(); list.clear();
} }
list.addAll(baseData.data.list); list.addAll(baseData.data.list);
if(!mounted)
return;
setState(() {}); setState(() {});
} }
} }
@ -119,18 +121,13 @@ class _FriendGroupList extends State<FriendGroupList> {
_refreshController.refreshFailed(); _refreshController.refreshFailed();
_refreshController.loadFailed(); _refreshController.loadFailed();
}); });
_refreshController.refreshCompleted();
_refreshController.loadComplete();
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
if (pageNum == 1) { if (pageNum == 1) {
list.clear(); list.clear();
} }
list.addAll(baseData.data.list); list.addAll(baseData.data.list);
print("list: ${list.length}"); if(!mounted)
if (int.tryParse(baseData.data.total) < (pageNum * 10)) { return;
_refreshController.loadNoData();
}
setState(() {}); setState(() {});
} }
} }
@ -146,7 +143,8 @@ class _FriendGroupList extends State<FriendGroupList> {
? NoDataView( ? NoDataView(
src: "assets/image/guan_zhu.webp", src: "assets/image/guan_zhu.webp",
isShowBtn: false, isShowBtn: false,
text: "目前暂无${widget?.title ?? ""},听说多发动态可以涨粉哦~", text: widget.title == "好友"?"目前暂无${widget?.title ?? ""}":("目前暂无${widget?.title ?? ""}${widget?.title == "" ?
"听说多发动态可以涨粉哦" :"可以在社群广场中关注自己喜欢的人哦"}~"),
fontSize: 16.sp, fontSize: 16.sp,
margin: EdgeInsets.only(top: 120.h,left: 60.w,right: 60.w), margin: EdgeInsets.only(top: 120.h,left: 60.w,right: 60.w),
):Expanded( ):Expanded(
@ -156,6 +154,7 @@ class _FriendGroupList extends State<FriendGroupList> {
shrinkWrap: true, shrinkWrap: true,
itemBuilder: (context, position) { itemBuilder: (context, position) {
return GestureDetector( return GestureDetector(
behavior: HitTestBehavior.opaque,
onTap:(){ onTap:(){
Navigator.of(context).pushNamed( Navigator.of(context).pushNamed(
'/router/chat_details_page', '/router/chat_details_page',
@ -184,8 +183,8 @@ class _FriendGroupList extends State<FriendGroupList> {
child: MImage( child: MImage(
list?.avatar ?? "", list?.avatar ?? "",
isCircle: true, isCircle: true,
width: 66, width: 66.h,
height: 66, height: 66.h,
fit: BoxFit.cover, fit: BoxFit.cover,
errorSrc: "assets/image/default_user.webp", errorSrc: "assets/image/default_user.webp",
fadeSrc: "assets/image/default_user.webp", fadeSrc: "assets/image/default_user.webp",

4
lib/im/im_view/im_page.dart

@ -229,7 +229,9 @@ class _IMPage extends State<IMPage> implements OnChatMessage {
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
onTap: () { onTap: () {
Navigator.of(context) Navigator.of(context)
.pushNamed('/router/chat_friend_group'); .pushNamed('/router/chat_friend_group').then((value) {
_refresh();
});
}, },
child: Container( child: Container(
padding: EdgeInsets.all(12), padding: EdgeInsets.all(12),

12
lib/retrofit/data/social_info.dart

@ -5,24 +5,29 @@ class SocialInfo {
SocialInfo({ SocialInfo({
dynamic fans, dynamic fans,
dynamic follow, dynamic follow,
dynamic achievementNumber}){ dynamic achievementNumber,
dynamic mutualFollowCount}){
_fans = fans; _fans = fans;
_follow = follow; _follow = follow;
_achievementNumber = achievementNumber; _achievementNumber = achievementNumber;
_mutualFollowCount = mutualFollowCount;
} }
SocialInfo.fromJson(dynamic json) { SocialInfo.fromJson(dynamic json) {
_fans = json['fans']; _fans = json['fans'];
_follow = json['follow']; _follow = json['follow'];
_achievementNumber = json['achievementNumber']; _achievementNumber = json['achievementNumber'];
_mutualFollowCount = json['mutualFollowCount'];
} }
dynamic _fans; dynamic _fans;
dynamic _follow; dynamic _follow;
dynamic _achievementNumber; dynamic _achievementNumber;
dynamic _mutualFollowCount;
dynamic get fans => _fans; dynamic get fans => _fans;
dynamic get follow => _follow; dynamic get follow => _follow;
dynamic get achievementNumber => _achievementNumber; dynamic get achievementNumber => _achievementNumber;
dynamic get mutualFollowCount => _mutualFollowCount;
set fans(int value) { set fans(int value) {
@ -34,6 +39,7 @@ class SocialInfo {
map['fans'] = _fans; map['fans'] = _fans;
map['follow'] = _follow; map['follow'] = _follow;
map['achievementNumber'] = _achievementNumber; map['achievementNumber'] = _achievementNumber;
map['mutualFollowCount'] = _mutualFollowCount;
return map; return map;
} }
@ -44,4 +50,8 @@ class SocialInfo {
set achievementNumber(int value) { set achievementNumber(int value) {
_achievementNumber = value; _achievementNumber = value;
} }
set mutualFollowCount(int value) {
_mutualFollowCount = value;
}
} }

2
lib/retrofit/retrofit_api.dart

@ -458,7 +458,7 @@ abstract class ApiService {
@DELETE("/information/trend/{id}") @DELETE("/information/trend/{id}")
Future<BaseData> deleteTrend(@Path("id") String id); Future<BaseData> deleteTrend(@Path("id") String id);
///(//) ///(///)
@GET("/member/socialInfo") @GET("/member/socialInfo")
Future<BaseData<SocialInfo>> socialInfo(); Future<BaseData<SocialInfo>> socialInfo();

Loading…
Cancel
Save