From 314aeddf23d082c40e849dd6613d2a7e16763e47 Mon Sep 17 00:00:00 2001 From: abu <3109389044@qq.com> Date: Mon, 13 Oct 2025 13:17:36 +0800 Subject: [PATCH] =?UTF-8?q?fix=5F=E6=9C=8B=E5=8F=8B&=E5=85=B3=E6=B3=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/IM/push_service.dart | 5 +- lib/layouts/index.dart | 10 ++ lib/models/share_type.dart | 2 +- lib/pages/chat/chat.dart | 140 +++++++++++++++++++------- lib/pages/video/index.dart | 30 +++--- lib/pages/video/module/attention.dart | 50 ++++----- lib/pages/video/module/friend.dart | 44 ++++---- 7 files changed, 178 insertions(+), 103 deletions(-) diff --git a/lib/IM/push_service.dart b/lib/IM/push_service.dart index 445a8ad..d13ec6d 100644 --- a/lib/IM/push_service.dart +++ b/lib/IM/push_service.dart @@ -75,10 +75,9 @@ class PushService { if (Platform.isAndroid) { await TencentImSDKPlugin.v2TIMManager.login(userID: Storage.read('userId'), userSig: Storage.read('userSig')); } - final token = await TencentCloudChatPush().getAndroidPushToken(); - + // final token = await TencentCloudChatPush().getAndroidPushToken(); logger.i( - '推送服务已注册,手机:$devices,证书ID:$apnsCertificateID,token=${token.code},tk=${token.data}', + '推送服务已注册,手机:$devices,证书ID:$apnsCertificateID', ); // 添加在线时监听器 diff --git a/lib/layouts/index.dart b/lib/layouts/index.dart index 82c1750..8dfc57f 100644 --- a/lib/layouts/index.dart +++ b/lib/layouts/index.dart @@ -5,6 +5,8 @@ import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:loopin/IM/controller/tab_bar_controller.dart'; import 'package:loopin/models/tab_type.dart'; +import 'package:loopin/pages/video/module/attention.dart'; +import 'package:loopin/pages/video/module/friend.dart'; import 'package:loopin/pages/video/module/recommend.dart'; import 'package:loopin/update/upgrade_service.dart'; import 'package:loopin/utils/common.dart'; @@ -250,8 +252,16 @@ class _LayoutState extends State { if (videoModuleController.videoTabIndex.value == 2) { RecommendModule.playVideo(); } + if (videoModuleController.videoTabIndex.value == 1) { + FriendModule.playVideo(); + } + if (videoModuleController.videoTabIndex.value == 0) { + AttentionModule.playVideo(); + } } else { RecommendModule.pauseVideo(); + FriendModule.pauseVideo(); + AttentionModule.pauseVideo(); } if ([2, 3, 4].contains(index) && !Common.isLogin()) { Get.toNamed('/login'); diff --git a/lib/models/share_type.dart b/lib/models/share_type.dart index 8d7c59e..c74c7a5 100644 --- a/lib/models/share_type.dart +++ b/lib/models/share_type.dart @@ -7,7 +7,7 @@ extension ShareTypeExtension on ShareType { case ShareType.video: return 'https://wuzhongjie.com.cn/spa/video-detail'; case ShareType.shop: - return 'https://wuzhongjie.com.cn/spa/goods-derail'; + return 'https://wuzhongjie.com.cn/spa/goods-detail'; } } } diff --git a/lib/pages/chat/chat.dart b/lib/pages/chat/chat.dart index 43baff5..1248ecb 100644 --- a/lib/pages/chat/chat.dart +++ b/lib/pages/chat/chat.dart @@ -32,6 +32,7 @@ import 'package:permission_handler/permission_handler.dart'; import 'package:shirne_dialog/shirne_dialog.dart'; import 'package:tencent_cloud_chat_sdk/enum/message_status.dart'; import 'package:tencent_cloud_chat_sdk/models/v2_tim_conversation.dart'; +import 'package:tencent_cloud_chat_sdk/models/v2_tim_friend_info.dart'; import 'package:tencent_cloud_chat_sdk/models/v2_tim_message.dart'; import 'package:video_player/video_player.dart'; import 'package:wechat_assets_picker/wechat_assets_picker.dart'; @@ -58,6 +59,8 @@ class _ChatState extends State with SingleTickerProviderStateMixin { // 接收参数 late final Rx arguments; + String blackTxt = '拉黑'; + late String selfUserId; // 聊天消息模块 @@ -167,6 +170,65 @@ class _ChatState extends State with SingleTickerProviderStateMixin { super.dispose(); } + // 获取拉黑列表 + Future getBlackList() async { + final res = await ImService.instance.blackList(); + if (res.success && res.data != null) { + // + final data = res.data; + for (V2TimFriendInfo element in data ?? []) { + logger.w(element.toJson()); + if (element.userID == arguments.value.userID) { + // 在拉黑列表 + logger.e('匹配'); + blackTxt = '取消拉黑'; + } + } + } + } + + // 取消拉黑 + void _cancelBlack() async { + logger.w('开始执行取消拉黑${arguments.value.userID}'); + final res = await ImService.instance.deleteFromBlackList(userIDList: [arguments.value.userID ?? '']); + logger.w(res.success); + // 成功后返回并删除会话 + if (res.success) { + blackTxt = '拉黑'; + Get.back(); + } + } + + // 拉黑 + void _addBlack() async { + logger.w('开始执行拉黑${arguments.value.userID}'); + final res = await ImService.instance.addToBlackList(userIDList: [arguments.value.userID ?? '']); + logger.w(res.success); + // 成功后返回并删除会话 + if (res.success) { + blackTxt = '取消拉黑'; + //删除会话,退出聊天 + await ImService.instance.deleteConversation(conversationID: 'c2c_${arguments.value.userID}'); + final ctl = Get.find(); + ctl.chatList.removeWhere( + (conv) => conv.conversation.conversationID == 'c2c_${arguments.value.userID}', + ); + ctl.chatList.refresh(); + Get.back(); + Get.back(); + } + } + + //拉黑/取消 + void _handleBlack() { + if (blackTxt == '拉黑') { + //_addBlack + _addBlack(); + } else { + _cancelBlack(); + } + } + // 设置好友备注 void setRemark() async { String remark = ''; @@ -344,24 +406,26 @@ class _ChatState extends State with SingleTickerProviderStateMixin { ), SizedBox(width: 4), ], - Ink( - decoration: BoxDecoration( - color: !(item.isSelf ?? false) ? Color(0xFFFFFFFF) : Color(0xFF89E45B), - borderRadius: BorderRadius.circular(10.0), - ), - child: InkWell( - overlayColor: WidgetStateProperty.all(Colors.transparent), - borderRadius: BorderRadius.circular(10.0), - child: Container( - padding: const EdgeInsets.all(10.0), - child: RichTextUtil.getRichText( - item.textElem?.text ?? '', - color: !(item.isSelf ?? false) ? Colors.black : Colors.white, - ), // 可自定义解析emoj/网址/电话 + Flexible( + child: Ink( + decoration: BoxDecoration( + color: !(item.isSelf ?? false) ? Color(0xFFFFFFFF) : Color(0xFF89E45B), + borderRadius: BorderRadius.circular(10.0), + ), + child: InkWell( + overlayColor: WidgetStateProperty.all(Colors.transparent), + borderRadius: BorderRadius.circular(10.0), + child: Container( + padding: const EdgeInsets.all(10.0), + child: RichTextUtil.getRichText( + item.textElem?.text ?? '', + color: !(item.isSelf ?? false) ? Colors.black : Colors.white, + ), // 可自定义解析emoj/网址/电话 + ), + onLongPress: () { + contextMenuDialog(); + }, ), - onLongPress: () { - contextMenuDialog(); - }, ), ), ], @@ -1820,23 +1884,23 @@ class _ChatState extends State with SingleTickerProviderStateMixin { } // 拉黑 - void _handleBlack() async { - logger.w('开始执行拉黑${arguments.value.userID}'); - final res = await ImService.instance.addToBlackList(userIDList: [arguments.value.userID ?? '']); - logger.w(res.success); - // 成功后返回并删除会话 - if (res.success) { - //删除会话,退出聊天 - await ImService.instance.deleteConversation(conversationID: arguments.value.conversationID); - final ctl = Get.find(); - ctl.chatList.removeWhere( - (conv) => conv.conversation.conversationID == arguments.value.conversationID, - ); - ctl.chatList.refresh(); - Get.back(); - Get.back(); - } - } + // void _handleBlack() async { + // logger.w('开始执行拉黑${arguments.value.userID}'); + // final res = await ImService.instance.addToBlackList(userIDList: [arguments.value.userID ?? '']); + // logger.w(res.success); + // // 成功后返回并删除会话 + // if (res.success) { + // //删除会话,退出聊天 + // await ImService.instance.deleteConversation(conversationID: arguments.value.conversationID); + // final ctl = Get.find(); + // ctl.chatList.removeWhere( + // (conv) => conv.conversation.conversationID == arguments.value.conversationID, + // ); + // ctl.chatList.refresh(); + // Get.back(); + // Get.back(); + // } + // } // 发群红包弹窗 void sendRedPacketDialog() { @@ -1915,6 +1979,7 @@ class _ChatState extends State with SingleTickerProviderStateMixin { color: Colors.white, ), onPressed: () async { + await getBlackList(); final paddingTop = MediaQuery.of(Get.context!).padding.top; final selected = await showMenu( @@ -1976,7 +2041,7 @@ class _ChatState extends State with SingleTickerProviderStateMixin { Icon(Icons.block, color: Colors.white, size: 18), SizedBox(width: 8), Text( - '拉黑', + blackTxt, style: TextStyle(color: Colors.white), ), ], @@ -2015,11 +2080,12 @@ class _ChatState extends State with SingleTickerProviderStateMixin { break; case 'block': // print('点击了拉黑'); + String showTxt = blackTxt == '拉黑' ? '拉黑后将不保留任何聊天记录' : ''; showDialog( context: context, builder: (context) { return AlertDialog( - content: const Text('确认要拉黑对方吗?拉黑后将不保留任何聊天记录', style: TextStyle(fontSize: 16.0)), + content: Text('确认要$blackTxt对方吗?$showTxt', style: TextStyle(fontSize: 16.0)), backgroundColor: Colors.white, surfaceTintColor: Colors.white, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(15.0)), @@ -2032,7 +2098,7 @@ class _ChatState extends State with SingleTickerProviderStateMixin { }, child: const Text('取消', style: TextStyle(color: Colors.black54)), ), - TextButton(onPressed: _handleBlack, child: const Text('确认拉黑', style: TextStyle(color: Colors.red))), + TextButton(onPressed: _handleBlack, child: const Text('确认', style: TextStyle(color: Colors.red))), ], ); }, diff --git a/lib/pages/video/index.dart b/lib/pages/video/index.dart index 42ae139..23c8d9b 100644 --- a/lib/pages/video/index.dart +++ b/lib/pages/video/index.dart @@ -9,16 +9,10 @@ import '../../IM/im_core.dart'; import '../../behavior/custom_scroll_behavior.dart'; import '../../components/keepalive_wrapper.dart'; import '../../controller/video_module_controller.dart'; - import './module/attention.dart'; -// import './module/browse.dart'; -// import './module/buying.dart'; -// import './module/drama.dart'; -// import './module/live.dart'; import './module/friend.dart'; import './module/recommend.dart'; // 引入tab内容模块 -// import './module/subscribe.dart'; class VideoPage extends StatefulWidget { const VideoPage({super.key}); @@ -118,8 +112,8 @@ class _VideoPageState extends State with SingleTickerProviderStateMix onTap: (index) { // 除了第二个推荐tab,其他tab都校验登录状态 if (!Common.isLogin() && index != 2) { - Get.toNamed('/login'); - return; + Get.toNamed('/login'); + return; } // 同步索引 videoModuleController.updateVideoTabIndex(index); @@ -137,12 +131,18 @@ class _VideoPageState extends State with SingleTickerProviderStateMix ), onPressed: () { print('当前tab索引:${videoModuleController.videoTabIndex.value}'); - if(videoModuleController.videoTabIndex.value == 0){ - AttentionModule.pauseVideo(); - }else if(videoModuleController.videoTabIndex.value ==1){ + if (videoModuleController.videoTabIndex.value == 0) { + AttentionModule.playVideo(); FriendModule.pauseVideo(); - }else if(videoModuleController.videoTabIndex.value ==2){ RecommendModule.pauseVideo(); + } else if (videoModuleController.videoTabIndex.value == 1) { + AttentionModule.pauseVideo(); + FriendModule.playVideo(); + RecommendModule.pauseVideo(); + } else if (videoModuleController.videoTabIndex.value == 2) { + AttentionModule.pauseVideo(); + FriendModule.pauseVideo(); + RecommendModule.playVideo(); } Get.toNamed('/search'); }, @@ -159,15 +159,15 @@ class _VideoPageState extends State with SingleTickerProviderStateMix // 根据当前 tab 控制对应播放器播放,其它暂停 if (index == 0) { AttentionModule.playVideo(); - // FriendModule.pauseVideo(); + FriendModule.pauseVideo(); RecommendModule.pauseVideo(); } else if (index == 1) { AttentionModule.pauseVideo(); - // FriendModule.playVideo(); + FriendModule.playVideo(); RecommendModule.pauseVideo(); } else if (index == 2) { AttentionModule.pauseVideo(); - // FriendModule.pauseVideo(); + FriendModule.pauseVideo(); RecommendModule.playVideo(); } videoModuleController.updateVideoTabIndex(index); diff --git a/lib/pages/video/module/attention.dart b/lib/pages/video/module/attention.dart index acba145..9496d2d 100644 --- a/lib/pages/video/module/attention.dart +++ b/lib/pages/video/module/attention.dart @@ -557,7 +557,7 @@ class _AttentionModuleState extends State { // 页面controller late PageController pageController = PageController( - initialPage: videoModuleController.videoPlayIndex.value, + initialPage: videoModuleController.videoPlayIndexFoucs.value, viewportFraction: 1.0, ); @@ -656,7 +656,7 @@ class _AttentionModuleState extends State { page = 1; isLoadingMore = false; videoList.clear(); - videoModuleController.updateVideoPlayIndex(0); + videoModuleController.updateVideoPlayIndex2(0); sliderValue = 0.0; sliderDraging = false; position = Duration.zero; @@ -708,7 +708,7 @@ class _AttentionModuleState extends State { // 初始化播放器 player.open( Media( - videoList[videoModuleController.videoPlayIndex.value]['url'], + videoList[videoModuleController.videoPlayIndexFoucs.value]['url'], ), play: false); player.setPlaylistMode(PlaylistMode.loop); // 循环播放; @@ -905,9 +905,9 @@ class _AttentionModuleState extends State { void handleShareClick(int index) { print("分享项 $index 被点击"); - final videoId = videoList[videoModuleController.videoPlayIndex.value]['id']; - final videoUrl = videoList[videoModuleController.videoPlayIndex.value]['url']; - final description = videoList[videoModuleController.videoPlayIndex.value]['title'] ?? '快来看看这个视频'; + final videoId = videoList[videoModuleController.videoPlayIndexFoucs.value]['id']; + final videoUrl = videoList[videoModuleController.videoPlayIndexFoucs.value]['url']; + final description = videoList[videoModuleController.videoPlayIndexFoucs.value]['title'] ?? '快来看看这个视频'; logger.i('分享链接地址----------------: ${ShareType.video.name}?id=$videoId'); if (index == 0) { // 分享好友 @@ -982,10 +982,10 @@ class _AttentionModuleState extends State { void handlCoverClick(V2TimConversation conv) async { // 发送VideoMsg,获取当前视频信息 final userId = conv.userID; - final String url = videoList[videoModuleController.videoPlayIndex.value]['url']; - final img = videoList[videoModuleController.videoPlayIndex.value]['firstFrameImg']; - final width = videoList[videoModuleController.videoPlayIndex.value]['width']; - final height = videoList[videoModuleController.videoPlayIndex.value]['height']; + final String url = videoList[videoModuleController.videoPlayIndexFoucs.value]['url']; + final img = videoList[videoModuleController.videoPlayIndexFoucs.value]['firstFrameImg']; + final width = videoList[videoModuleController.videoPlayIndexFoucs.value]['width']; + final height = videoList[videoModuleController.videoPlayIndexFoucs.value]['height']; final makeJson = jsonEncode({ "width": width, "height": height, @@ -1049,7 +1049,7 @@ class _AttentionModuleState extends State { scrollDirection: Axis.vertical, controller: pageController, onPageChanged: (index) async { - videoModuleController.updateVideoPlayIndex(index); + videoModuleController.updateVideoPlayIndex2(index); setState(() { sliderValue = 0.0; sliderDraging = false; @@ -1081,7 +1081,7 @@ class _AttentionModuleState extends State { child: Stack( children: [ Visibility( - visible: videoModuleController.videoPlayIndex.value == index && position > Duration.zero, + visible: videoModuleController.videoPlayIndexFoucs.value == index && position > Duration.zero, child: Video( controller: videoController, fit: isHorizontal ? BoxFit.contain : BoxFit.cover, @@ -1089,7 +1089,7 @@ class _AttentionModuleState extends State { ), ), AnimatedOpacity( - opacity: videoModuleController.videoPlayIndex.value == index && position > Duration(milliseconds: 100) ? 0.0 : 1.0, + opacity: videoModuleController.videoPlayIndexFoucs.value == index && position > Duration(milliseconds: 100) ? 0.0 : 1.0, duration: Duration(milliseconds: 50), child: Image.network( videoList[index]['firstFrameImg'] ?? 'https://wuzhongjie.com.cn/download/logo.png', @@ -1143,7 +1143,7 @@ class _AttentionModuleState extends State { onTap: () async { player.pause(); // 跳转到 Vloger 页面并等待返回结果 - final vloggerId = videoList[videoModuleController.videoPlayIndex.value]['memberId']; + final vloggerId = videoList[videoModuleController.videoPlayIndexFoucs.value]['memberId']; final result = await Get.toNamed('/vloger', arguments: {'memberId': vloggerId}); if (result != null) { // 处理返回的参数 @@ -1277,7 +1277,7 @@ class _AttentionModuleState extends State { onTap: () async { player.pause(); // 跳转到举报页面并等待返回结果 - final result = await Get.toNamed('/report', arguments: videoList[videoModuleController.videoPlayIndex.value]); + final result = await Get.toNamed('/report', arguments: videoList[videoModuleController.videoPlayIndexFoucs.value]); if (result != null) { player.play(); } @@ -1293,9 +1293,9 @@ class _AttentionModuleState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - if (videoModuleController.videoPlayIndex.value < videoList.length) + if (videoModuleController.videoPlayIndexFoucs.value < videoList.length) Text( - '@${videoList[videoModuleController.videoPlayIndex.value]['nickname'] ?? '未知'}', + '@${videoList[videoModuleController.videoPlayIndexFoucs.value]['nickname'] ?? '未知'}', style: const TextStyle(color: Colors.white, fontSize: 16.0), ) else @@ -1303,10 +1303,10 @@ class _AttentionModuleState extends State { '@未知', style: const TextStyle(color: Colors.white, fontSize: 16.0), ), - if (videoModuleController.videoPlayIndex.value < videoList.length) + if (videoModuleController.videoPlayIndexFoucs.value < videoList.length) LayoutBuilder( builder: (context, constraints) { - final text = videoList[videoModuleController.videoPlayIndex.value]['title'] ?? '未知'; + final text = videoList[videoModuleController.videoPlayIndexFoucs.value]['title'] ?? '未知'; final span = TextSpan( text: text, style: const TextStyle(color: Colors.white, fontSize: 14.0), @@ -1324,8 +1324,8 @@ class _AttentionModuleState extends State { children: [ Text( text, - maxLines: videoList[videoModuleController.videoPlayIndex.value]['expanded'] ? null : 3, - overflow: videoList[videoModuleController.videoPlayIndex.value]['expanded'] + maxLines: videoList[videoModuleController.videoPlayIndexFoucs.value]['expanded'] ? null : 3, + overflow: videoList[videoModuleController.videoPlayIndexFoucs.value]['expanded'] ? TextOverflow.visible : TextOverflow.ellipsis, style: const TextStyle(color: Colors.white, fontSize: 14.0), @@ -1336,12 +1336,12 @@ class _AttentionModuleState extends State { child: GestureDetector( onTap: () { setState(() { - videoList[videoModuleController.videoPlayIndex.value]['expanded'] = - !videoList[videoModuleController.videoPlayIndex.value]['expanded']; + videoList[videoModuleController.videoPlayIndexFoucs.value]['expanded'] = + !videoList[videoModuleController.videoPlayIndexFoucs.value]['expanded']; }); }, child: Text( - videoList[videoModuleController.videoPlayIndex.value]['expanded'] ? '收起' : '展开更多', + videoList[videoModuleController.videoPlayIndexFoucs.value]['expanded'] ? '收起' : '展开更多', textAlign: TextAlign.right, style: const TextStyle( color: Colors.white, @@ -1364,7 +1364,7 @@ class _AttentionModuleState extends State { left: 6.0, right: 6.0, child: Visibility( - visible: videoModuleController.videoPlayIndex.value == index && position > Duration.zero, + visible: videoModuleController.videoPlayIndexFoucs.value == index && position > Duration.zero, child: Listener( child: SliderTheme( data: SliderThemeData( diff --git a/lib/pages/video/module/friend.dart b/lib/pages/video/module/friend.dart index 66889c4..e432931 100644 --- a/lib/pages/video/module/friend.dart +++ b/lib/pages/video/module/friend.dart @@ -558,7 +558,7 @@ class _FriendModuleState extends State { // 页面controller late PageController pageController = PageController( - initialPage: videoModuleController.videoPlayIndex.value, + initialPage: videoModuleController.videoPlayFriend.value, viewportFraction: 1.0, ); @@ -657,7 +657,7 @@ class _FriendModuleState extends State { page = 1; isLoadingMore = false; videoList.clear(); - videoModuleController.updateVideoPlayIndex(0); + videoModuleController.updateVideoPlayIndex1(0); sliderValue = 0.0; sliderDraging = false; position = Duration.zero; @@ -709,7 +709,7 @@ class _FriendModuleState extends State { // 初始化播放器 player.open( Media( - videoList[videoModuleController.videoPlayIndex.value]['url'], + videoList[videoModuleController.videoPlayFriend.value]['url'], ), play: false); player.setPlaylistMode(PlaylistMode.loop); // 循环播放; @@ -905,9 +905,9 @@ class _FriendModuleState extends State { void handleShareClick(int index) { print("分享项 $index 被点击"); - final videoId = videoList[videoModuleController.videoPlayIndex.value]['id']; - final videoUrl = videoList[videoModuleController.videoPlayIndex.value]['url']; - final description = videoList[videoModuleController.videoPlayIndex.value]['title'] ?? '快来看看这个视频'; + final videoId = videoList[videoModuleController.videoPlayFriend.value]['id']; + final videoUrl = videoList[videoModuleController.videoPlayFriend.value]['url']; + final description = videoList[videoModuleController.videoPlayFriend.value]['title'] ?? '快来看看这个视频'; logger.i('分享链接地址----------------: ${ShareType.video.name}?id=$videoId'); if (index == 0) { // 分享好友 @@ -982,7 +982,7 @@ class _FriendModuleState extends State { void handlCoverClick(V2TimConversation conv) async { // 发送VideoMsg,获取当前视频信息 final userId = conv.userID; - final currentVideo = videoList[videoModuleController.videoPlayIndex.value]; + final currentVideo = videoList[videoModuleController.videoPlayFriend.value]; logger.w(currentVideo); final img = (currentVideo['cover'] != null && currentVideo['cover'].toString().isNotEmpty) ? currentVideo['cover'] : currentVideo['firstFrameImg']; final url = currentVideo['url']; @@ -1054,7 +1054,7 @@ class _FriendModuleState extends State { scrollDirection: Axis.vertical, controller: pageController, onPageChanged: (index) async { - videoModuleController.updateVideoPlayIndex(index); + videoModuleController.updateVideoPlayIndex1(index); setState(() { sliderValue = 0.0; sliderDraging = false; @@ -1086,7 +1086,7 @@ class _FriendModuleState extends State { child: Stack( children: [ Visibility( - visible: videoModuleController.videoPlayIndex.value == index && position > Duration.zero, + visible: videoModuleController.videoPlayFriend.value == index && position > Duration.zero, child: Video( controller: videoController, fit: isHorizontal ? BoxFit.contain : BoxFit.cover, @@ -1094,7 +1094,7 @@ class _FriendModuleState extends State { ), ), AnimatedOpacity( - opacity: videoModuleController.videoPlayIndex.value == index && position > Duration(milliseconds: 100) ? 0.0 : 1.0, + opacity: videoModuleController.videoPlayFriend.value == index && position > Duration(milliseconds: 100) ? 0.0 : 1.0, duration: Duration(milliseconds: 50), child: Image.network( videoList[index]['firstFrameImg'] ?? 'https://wuzhongjie.com.cn/download/logo.png', @@ -1148,7 +1148,7 @@ class _FriendModuleState extends State { onTap: () async { player.pause(); // 跳转到 Vloger 页面并等待返回结果 - final vloggerId = videoList[videoModuleController.videoPlayIndex.value]['memberId']; + final vloggerId = videoList[videoModuleController.videoPlayFriend.value]['memberId']; final result = await Get.toNamed('/vloger', arguments: {'memberId': vloggerId}); if (result != null) { // 处理返回的参数 @@ -1282,7 +1282,7 @@ class _FriendModuleState extends State { onTap: () async { player.pause(); // 跳转到举报页面并等待返回结果 - final result = await Get.toNamed('/report', arguments: videoList[videoModuleController.videoPlayIndex.value]); + final result = await Get.toNamed('/report', arguments: videoList[videoModuleController.videoPlayFriend.value]); if (result != null) { player.play(); } @@ -1298,9 +1298,9 @@ class _FriendModuleState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - if (videoModuleController.videoPlayIndex.value < videoList.length) + if (videoModuleController.videoPlayFriend.value < videoList.length) Text( - '@${videoList[videoModuleController.videoPlayIndex.value]['nickname'] ?? '未知'}', + '@${videoList[videoModuleController.videoPlayFriend.value]['nickname'] ?? '未知'}', style: const TextStyle(color: Colors.white, fontSize: 16.0), ) else @@ -1309,10 +1309,10 @@ class _FriendModuleState extends State { style: const TextStyle(color: Colors.white, fontSize: 16.0), ), // 对下面的 LayoutBuilder 也需要同样的检查 - if (videoModuleController.videoPlayIndex.value < videoList.length) + if (videoModuleController.videoPlayFriend.value < videoList.length) LayoutBuilder( builder: (context, constraints) { - final text = videoList[videoModuleController.videoPlayIndex.value]['title'] ?? '未知'; + final text = videoList[videoModuleController.videoPlayFriend.value]['title'] ?? '未知'; final span = TextSpan( text: text, style: const TextStyle(color: Colors.white, fontSize: 14.0), @@ -1330,8 +1330,8 @@ class _FriendModuleState extends State { children: [ Text( text, - maxLines: videoList[videoModuleController.videoPlayIndex.value]['expanded'] ? null : 3, - overflow: videoList[videoModuleController.videoPlayIndex.value]['expanded'] + maxLines: videoList[videoModuleController.videoPlayFriend.value]['expanded'] ? null : 3, + overflow: videoList[videoModuleController.videoPlayFriend.value]['expanded'] ? TextOverflow.visible : TextOverflow.ellipsis, style: const TextStyle(color: Colors.white, fontSize: 14.0), @@ -1342,12 +1342,12 @@ class _FriendModuleState extends State { child: GestureDetector( onTap: () { setState(() { - videoList[videoModuleController.videoPlayIndex.value]['expanded'] = - !videoList[videoModuleController.videoPlayIndex.value]['expanded']; + videoList[videoModuleController.videoPlayFriend.value]['expanded'] = + !videoList[videoModuleController.videoPlayFriend.value]['expanded']; }); }, child: Text( - videoList[videoModuleController.videoPlayIndex.value]['expanded'] ? '收起' : '展开更多', + videoList[videoModuleController.videoPlayFriend.value]['expanded'] ? '收起' : '展开更多', textAlign: TextAlign.right, style: const TextStyle( color: Colors.white, @@ -1370,7 +1370,7 @@ class _FriendModuleState extends State { left: 6.0, right: 6.0, child: Visibility( - visible: videoModuleController.videoPlayIndex.value == index && position > Duration.zero, + visible: videoModuleController.videoPlayFriend.value == index && position > Duration.zero, child: Listener( child: SliderTheme( data: SliderThemeData(