fix_朋友&关注

This commit is contained in:
abu 2025-10-13 13:17:36 +08:00
parent 9902980bf8
commit 314aeddf23
7 changed files with 178 additions and 103 deletions

View File

@ -75,10 +75,9 @@ class PushService {
if (Platform.isAndroid) { if (Platform.isAndroid) {
await TencentImSDKPlugin.v2TIMManager.login(userID: Storage.read('userId'), userSig: Storage.read('userSig')); await TencentImSDKPlugin.v2TIMManager.login(userID: Storage.read('userId'), userSig: Storage.read('userSig'));
} }
final token = await TencentCloudChatPush().getAndroidPushToken(); // final token = await TencentCloudChatPush().getAndroidPushToken();
logger.i( logger.i(
'推送服务已注册,手机:$devices,证书ID:$apnsCertificateID,token=${token.code},tk=${token.data}', '推送服务已注册,手机:$devices,证书ID:$apnsCertificateID',
); );
// 线 // 线

View File

@ -5,6 +5,8 @@ import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:loopin/IM/controller/tab_bar_controller.dart'; import 'package:loopin/IM/controller/tab_bar_controller.dart';
import 'package:loopin/models/tab_type.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/pages/video/module/recommend.dart';
import 'package:loopin/update/upgrade_service.dart'; import 'package:loopin/update/upgrade_service.dart';
import 'package:loopin/utils/common.dart'; import 'package:loopin/utils/common.dart';
@ -250,8 +252,16 @@ class _LayoutState extends State<Layout> {
if (videoModuleController.videoTabIndex.value == 2) { if (videoModuleController.videoTabIndex.value == 2) {
RecommendModule.playVideo(); RecommendModule.playVideo();
} }
if (videoModuleController.videoTabIndex.value == 1) {
FriendModule.playVideo();
}
if (videoModuleController.videoTabIndex.value == 0) {
AttentionModule.playVideo();
}
} else { } else {
RecommendModule.pauseVideo(); RecommendModule.pauseVideo();
FriendModule.pauseVideo();
AttentionModule.pauseVideo();
} }
if ([2, 3, 4].contains(index) && !Common.isLogin()) { if ([2, 3, 4].contains(index) && !Common.isLogin()) {
Get.toNamed('/login'); Get.toNamed('/login');

View File

@ -7,7 +7,7 @@ extension ShareTypeExtension on ShareType {
case ShareType.video: case ShareType.video:
return 'https://wuzhongjie.com.cn/spa/video-detail'; return 'https://wuzhongjie.com.cn/spa/video-detail';
case ShareType.shop: case ShareType.shop:
return 'https://wuzhongjie.com.cn/spa/goods-derail'; return 'https://wuzhongjie.com.cn/spa/goods-detail';
} }
} }
} }

View File

@ -32,6 +32,7 @@ import 'package:permission_handler/permission_handler.dart';
import 'package:shirne_dialog/shirne_dialog.dart'; import 'package:shirne_dialog/shirne_dialog.dart';
import 'package:tencent_cloud_chat_sdk/enum/message_status.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_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:tencent_cloud_chat_sdk/models/v2_tim_message.dart';
import 'package:video_player/video_player.dart'; import 'package:video_player/video_player.dart';
import 'package:wechat_assets_picker/wechat_assets_picker.dart'; import 'package:wechat_assets_picker/wechat_assets_picker.dart';
@ -58,6 +59,8 @@ class _ChatState extends State<Chat> with SingleTickerProviderStateMixin {
// //
late final Rx<V2TimConversation> arguments; late final Rx<V2TimConversation> arguments;
String blackTxt = '拉黑';
late String selfUserId; late String selfUserId;
// //
@ -167,6 +170,65 @@ class _ChatState extends State<Chat> with SingleTickerProviderStateMixin {
super.dispose(); super.dispose();
} }
//
Future<void> 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<ChatController>();
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 { void setRemark() async {
String remark = ''; String remark = '';
@ -344,7 +406,8 @@ class _ChatState extends State<Chat> with SingleTickerProviderStateMixin {
), ),
SizedBox(width: 4), SizedBox(width: 4),
], ],
Ink( Flexible(
child: Ink(
decoration: BoxDecoration( decoration: BoxDecoration(
color: !(item.isSelf ?? false) ? Color(0xFFFFFFFF) : Color(0xFF89E45B), color: !(item.isSelf ?? false) ? Color(0xFFFFFFFF) : Color(0xFF89E45B),
borderRadius: BorderRadius.circular(10.0), borderRadius: BorderRadius.circular(10.0),
@ -364,6 +427,7 @@ class _ChatState extends State<Chat> with SingleTickerProviderStateMixin {
}, },
), ),
), ),
),
], ],
), ),
), ),
@ -1820,23 +1884,23 @@ class _ChatState extends State<Chat> with SingleTickerProviderStateMixin {
} }
// //
void _handleBlack() async { // void _handleBlack() async {
logger.w('开始执行拉黑${arguments.value.userID}'); // logger.w('开始执行拉黑${arguments.value.userID}');
final res = await ImService.instance.addToBlackList(userIDList: [arguments.value.userID ?? '']); // final res = await ImService.instance.addToBlackList(userIDList: [arguments.value.userID ?? '']);
logger.w(res.success); // logger.w(res.success);
// // //
if (res.success) { // if (res.success) {
//退 // //退
await ImService.instance.deleteConversation(conversationID: arguments.value.conversationID); // await ImService.instance.deleteConversation(conversationID: arguments.value.conversationID);
final ctl = Get.find<ChatController>(); // final ctl = Get.find<ChatController>();
ctl.chatList.removeWhere( // ctl.chatList.removeWhere(
(conv) => conv.conversation.conversationID == arguments.value.conversationID, // (conv) => conv.conversation.conversationID == arguments.value.conversationID,
); // );
ctl.chatList.refresh(); // ctl.chatList.refresh();
Get.back(); // Get.back();
Get.back(); // Get.back();
} // }
} // }
// //
void sendRedPacketDialog() { void sendRedPacketDialog() {
@ -1915,6 +1979,7 @@ class _ChatState extends State<Chat> with SingleTickerProviderStateMixin {
color: Colors.white, color: Colors.white,
), ),
onPressed: () async { onPressed: () async {
await getBlackList();
final paddingTop = MediaQuery.of(Get.context!).padding.top; final paddingTop = MediaQuery.of(Get.context!).padding.top;
final selected = await showMenu( final selected = await showMenu(
@ -1976,7 +2041,7 @@ class _ChatState extends State<Chat> with SingleTickerProviderStateMixin {
Icon(Icons.block, color: Colors.white, size: 18), Icon(Icons.block, color: Colors.white, size: 18),
SizedBox(width: 8), SizedBox(width: 8),
Text( Text(
'拉黑', blackTxt,
style: TextStyle(color: Colors.white), style: TextStyle(color: Colors.white),
), ),
], ],
@ -2015,11 +2080,12 @@ class _ChatState extends State<Chat> with SingleTickerProviderStateMixin {
break; break;
case 'block': case 'block':
// print('点击了拉黑'); // print('点击了拉黑');
String showTxt = blackTxt == '拉黑' ? '拉黑后将不保留任何聊天记录' : '';
showDialog( showDialog(
context: context, context: context,
builder: (context) { builder: (context) {
return AlertDialog( return AlertDialog(
content: const Text('确认要拉黑对方吗?拉黑后将不保留任何聊天记录', style: TextStyle(fontSize: 16.0)), content: Text('确认要$blackTxt对方吗$showTxt', style: TextStyle(fontSize: 16.0)),
backgroundColor: Colors.white, backgroundColor: Colors.white,
surfaceTintColor: Colors.white, surfaceTintColor: Colors.white,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(15.0)), shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(15.0)),
@ -2032,7 +2098,7 @@ class _ChatState extends State<Chat> with SingleTickerProviderStateMixin {
}, },
child: const Text('取消', style: TextStyle(color: Colors.black54)), 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))),
], ],
); );
}, },

View File

@ -9,16 +9,10 @@ import '../../IM/im_core.dart';
import '../../behavior/custom_scroll_behavior.dart'; import '../../behavior/custom_scroll_behavior.dart';
import '../../components/keepalive_wrapper.dart'; import '../../components/keepalive_wrapper.dart';
import '../../controller/video_module_controller.dart'; import '../../controller/video_module_controller.dart';
import './module/attention.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/friend.dart';
import './module/recommend.dart'; import './module/recommend.dart';
// tab内容模块 // tab内容模块
// import './module/subscribe.dart';
class VideoPage extends StatefulWidget { class VideoPage extends StatefulWidget {
const VideoPage({super.key}); const VideoPage({super.key});
@ -137,12 +131,18 @@ class _VideoPageState extends State<VideoPage> with SingleTickerProviderStateMix
), ),
onPressed: () { onPressed: () {
print('当前tab索引:${videoModuleController.videoTabIndex.value}'); print('当前tab索引:${videoModuleController.videoTabIndex.value}');
if(videoModuleController.videoTabIndex.value == 0){ if (videoModuleController.videoTabIndex.value == 0) {
AttentionModule.pauseVideo(); AttentionModule.playVideo();
}else if(videoModuleController.videoTabIndex.value ==1){
FriendModule.pauseVideo(); FriendModule.pauseVideo();
}else if(videoModuleController.videoTabIndex.value ==2){
RecommendModule.pauseVideo(); 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'); Get.toNamed('/search');
}, },
@ -159,15 +159,15 @@ class _VideoPageState extends State<VideoPage> with SingleTickerProviderStateMix
// tab // tab
if (index == 0) { if (index == 0) {
AttentionModule.playVideo(); AttentionModule.playVideo();
// FriendModule.pauseVideo(); FriendModule.pauseVideo();
RecommendModule.pauseVideo(); RecommendModule.pauseVideo();
} else if (index == 1) { } else if (index == 1) {
AttentionModule.pauseVideo(); AttentionModule.pauseVideo();
// FriendModule.playVideo(); FriendModule.playVideo();
RecommendModule.pauseVideo(); RecommendModule.pauseVideo();
} else if (index == 2) { } else if (index == 2) {
AttentionModule.pauseVideo(); AttentionModule.pauseVideo();
// FriendModule.pauseVideo(); FriendModule.pauseVideo();
RecommendModule.playVideo(); RecommendModule.playVideo();
} }
videoModuleController.updateVideoTabIndex(index); videoModuleController.updateVideoTabIndex(index);

View File

@ -557,7 +557,7 @@ class _AttentionModuleState extends State<AttentionModule> {
// controller // controller
late PageController pageController = PageController( late PageController pageController = PageController(
initialPage: videoModuleController.videoPlayIndex.value, initialPage: videoModuleController.videoPlayIndexFoucs.value,
viewportFraction: 1.0, viewportFraction: 1.0,
); );
@ -656,7 +656,7 @@ class _AttentionModuleState extends State<AttentionModule> {
page = 1; page = 1;
isLoadingMore = false; isLoadingMore = false;
videoList.clear(); videoList.clear();
videoModuleController.updateVideoPlayIndex(0); videoModuleController.updateVideoPlayIndex2(0);
sliderValue = 0.0; sliderValue = 0.0;
sliderDraging = false; sliderDraging = false;
position = Duration.zero; position = Duration.zero;
@ -708,7 +708,7 @@ class _AttentionModuleState extends State<AttentionModule> {
// //
player.open( player.open(
Media( Media(
videoList[videoModuleController.videoPlayIndex.value]['url'], videoList[videoModuleController.videoPlayIndexFoucs.value]['url'],
), ),
play: false); play: false);
player.setPlaylistMode(PlaylistMode.loop); // ; player.setPlaylistMode(PlaylistMode.loop); // ;
@ -905,9 +905,9 @@ class _AttentionModuleState extends State<AttentionModule> {
void handleShareClick(int index) { void handleShareClick(int index) {
print("分享项 $index 被点击"); print("分享项 $index 被点击");
final videoId = videoList[videoModuleController.videoPlayIndex.value]['id']; final videoId = videoList[videoModuleController.videoPlayIndexFoucs.value]['id'];
final videoUrl = videoList[videoModuleController.videoPlayIndex.value]['url']; final videoUrl = videoList[videoModuleController.videoPlayIndexFoucs.value]['url'];
final description = videoList[videoModuleController.videoPlayIndex.value]['title'] ?? '快来看看这个视频'; final description = videoList[videoModuleController.videoPlayIndexFoucs.value]['title'] ?? '快来看看这个视频';
logger.i('分享链接地址----------------: ${ShareType.video.name}?id=$videoId'); logger.i('分享链接地址----------------: ${ShareType.video.name}?id=$videoId');
if (index == 0) { if (index == 0) {
// //
@ -982,10 +982,10 @@ class _AttentionModuleState extends State<AttentionModule> {
void handlCoverClick(V2TimConversation conv) async { void handlCoverClick(V2TimConversation conv) async {
// VideoMsg, // VideoMsg,
final userId = conv.userID; final userId = conv.userID;
final String url = videoList[videoModuleController.videoPlayIndex.value]['url']; final String url = videoList[videoModuleController.videoPlayIndexFoucs.value]['url'];
final img = videoList[videoModuleController.videoPlayIndex.value]['firstFrameImg']; final img = videoList[videoModuleController.videoPlayIndexFoucs.value]['firstFrameImg'];
final width = videoList[videoModuleController.videoPlayIndex.value]['width']; final width = videoList[videoModuleController.videoPlayIndexFoucs.value]['width'];
final height = videoList[videoModuleController.videoPlayIndex.value]['height']; final height = videoList[videoModuleController.videoPlayIndexFoucs.value]['height'];
final makeJson = jsonEncode({ final makeJson = jsonEncode({
"width": width, "width": width,
"height": height, "height": height,
@ -1049,7 +1049,7 @@ class _AttentionModuleState extends State<AttentionModule> {
scrollDirection: Axis.vertical, scrollDirection: Axis.vertical,
controller: pageController, controller: pageController,
onPageChanged: (index) async { onPageChanged: (index) async {
videoModuleController.updateVideoPlayIndex(index); videoModuleController.updateVideoPlayIndex2(index);
setState(() { setState(() {
sliderValue = 0.0; sliderValue = 0.0;
sliderDraging = false; sliderDraging = false;
@ -1081,7 +1081,7 @@ class _AttentionModuleState extends State<AttentionModule> {
child: Stack( child: Stack(
children: [ children: [
Visibility( Visibility(
visible: videoModuleController.videoPlayIndex.value == index && position > Duration.zero, visible: videoModuleController.videoPlayIndexFoucs.value == index && position > Duration.zero,
child: Video( child: Video(
controller: videoController, controller: videoController,
fit: isHorizontal ? BoxFit.contain : BoxFit.cover, fit: isHorizontal ? BoxFit.contain : BoxFit.cover,
@ -1089,7 +1089,7 @@ class _AttentionModuleState extends State<AttentionModule> {
), ),
), ),
AnimatedOpacity( 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), duration: Duration(milliseconds: 50),
child: Image.network( child: Image.network(
videoList[index]['firstFrameImg'] ?? 'https://wuzhongjie.com.cn/download/logo.png', videoList[index]['firstFrameImg'] ?? 'https://wuzhongjie.com.cn/download/logo.png',
@ -1143,7 +1143,7 @@ class _AttentionModuleState extends State<AttentionModule> {
onTap: () async { onTap: () async {
player.pause(); player.pause();
// Vloger // Vloger
final vloggerId = videoList[videoModuleController.videoPlayIndex.value]['memberId']; final vloggerId = videoList[videoModuleController.videoPlayIndexFoucs.value]['memberId'];
final result = await Get.toNamed('/vloger', arguments: {'memberId': vloggerId}); final result = await Get.toNamed('/vloger', arguments: {'memberId': vloggerId});
if (result != null) { if (result != null) {
// //
@ -1277,7 +1277,7 @@ class _AttentionModuleState extends State<AttentionModule> {
onTap: () async { onTap: () async {
player.pause(); 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) { if (result != null) {
player.play(); player.play();
} }
@ -1293,9 +1293,9 @@ class _AttentionModuleState extends State<AttentionModule> {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
if (videoModuleController.videoPlayIndex.value < videoList.length) if (videoModuleController.videoPlayIndexFoucs.value < videoList.length)
Text( Text(
'@${videoList[videoModuleController.videoPlayIndex.value]['nickname'] ?? '未知'}', '@${videoList[videoModuleController.videoPlayIndexFoucs.value]['nickname'] ?? '未知'}',
style: const TextStyle(color: Colors.white, fontSize: 16.0), style: const TextStyle(color: Colors.white, fontSize: 16.0),
) )
else else
@ -1303,10 +1303,10 @@ class _AttentionModuleState extends State<AttentionModule> {
'@未知', '@未知',
style: const TextStyle(color: Colors.white, fontSize: 16.0), style: const TextStyle(color: Colors.white, fontSize: 16.0),
), ),
if (videoModuleController.videoPlayIndex.value < videoList.length) if (videoModuleController.videoPlayIndexFoucs.value < videoList.length)
LayoutBuilder( LayoutBuilder(
builder: (context, constraints) { builder: (context, constraints) {
final text = videoList[videoModuleController.videoPlayIndex.value]['title'] ?? '未知'; final text = videoList[videoModuleController.videoPlayIndexFoucs.value]['title'] ?? '未知';
final span = TextSpan( final span = TextSpan(
text: text, text: text,
style: const TextStyle(color: Colors.white, fontSize: 14.0), style: const TextStyle(color: Colors.white, fontSize: 14.0),
@ -1324,8 +1324,8 @@ class _AttentionModuleState extends State<AttentionModule> {
children: [ children: [
Text( Text(
text, text,
maxLines: videoList[videoModuleController.videoPlayIndex.value]['expanded'] ? null : 3, maxLines: videoList[videoModuleController.videoPlayIndexFoucs.value]['expanded'] ? null : 3,
overflow: videoList[videoModuleController.videoPlayIndex.value]['expanded'] overflow: videoList[videoModuleController.videoPlayIndexFoucs.value]['expanded']
? TextOverflow.visible ? TextOverflow.visible
: TextOverflow.ellipsis, : TextOverflow.ellipsis,
style: const TextStyle(color: Colors.white, fontSize: 14.0), style: const TextStyle(color: Colors.white, fontSize: 14.0),
@ -1336,12 +1336,12 @@ class _AttentionModuleState extends State<AttentionModule> {
child: GestureDetector( child: GestureDetector(
onTap: () { onTap: () {
setState(() { setState(() {
videoList[videoModuleController.videoPlayIndex.value]['expanded'] = videoList[videoModuleController.videoPlayIndexFoucs.value]['expanded'] =
!videoList[videoModuleController.videoPlayIndex.value]['expanded']; !videoList[videoModuleController.videoPlayIndexFoucs.value]['expanded'];
}); });
}, },
child: Text( child: Text(
videoList[videoModuleController.videoPlayIndex.value]['expanded'] ? '收起' : '展开更多', videoList[videoModuleController.videoPlayIndexFoucs.value]['expanded'] ? '收起' : '展开更多',
textAlign: TextAlign.right, textAlign: TextAlign.right,
style: const TextStyle( style: const TextStyle(
color: Colors.white, color: Colors.white,
@ -1364,7 +1364,7 @@ class _AttentionModuleState extends State<AttentionModule> {
left: 6.0, left: 6.0,
right: 6.0, right: 6.0,
child: Visibility( child: Visibility(
visible: videoModuleController.videoPlayIndex.value == index && position > Duration.zero, visible: videoModuleController.videoPlayIndexFoucs.value == index && position > Duration.zero,
child: Listener( child: Listener(
child: SliderTheme( child: SliderTheme(
data: SliderThemeData( data: SliderThemeData(

View File

@ -558,7 +558,7 @@ class _FriendModuleState extends State<FriendModule> {
// controller // controller
late PageController pageController = PageController( late PageController pageController = PageController(
initialPage: videoModuleController.videoPlayIndex.value, initialPage: videoModuleController.videoPlayFriend.value,
viewportFraction: 1.0, viewportFraction: 1.0,
); );
@ -657,7 +657,7 @@ class _FriendModuleState extends State<FriendModule> {
page = 1; page = 1;
isLoadingMore = false; isLoadingMore = false;
videoList.clear(); videoList.clear();
videoModuleController.updateVideoPlayIndex(0); videoModuleController.updateVideoPlayIndex1(0);
sliderValue = 0.0; sliderValue = 0.0;
sliderDraging = false; sliderDraging = false;
position = Duration.zero; position = Duration.zero;
@ -709,7 +709,7 @@ class _FriendModuleState extends State<FriendModule> {
// //
player.open( player.open(
Media( Media(
videoList[videoModuleController.videoPlayIndex.value]['url'], videoList[videoModuleController.videoPlayFriend.value]['url'],
), ),
play: false); play: false);
player.setPlaylistMode(PlaylistMode.loop); // ; player.setPlaylistMode(PlaylistMode.loop); // ;
@ -905,9 +905,9 @@ class _FriendModuleState extends State<FriendModule> {
void handleShareClick(int index) { void handleShareClick(int index) {
print("分享项 $index 被点击"); print("分享项 $index 被点击");
final videoId = videoList[videoModuleController.videoPlayIndex.value]['id']; final videoId = videoList[videoModuleController.videoPlayFriend.value]['id'];
final videoUrl = videoList[videoModuleController.videoPlayIndex.value]['url']; final videoUrl = videoList[videoModuleController.videoPlayFriend.value]['url'];
final description = videoList[videoModuleController.videoPlayIndex.value]['title'] ?? '快来看看这个视频'; final description = videoList[videoModuleController.videoPlayFriend.value]['title'] ?? '快来看看这个视频';
logger.i('分享链接地址----------------: ${ShareType.video.name}?id=$videoId'); logger.i('分享链接地址----------------: ${ShareType.video.name}?id=$videoId');
if (index == 0) { if (index == 0) {
// //
@ -982,7 +982,7 @@ class _FriendModuleState extends State<FriendModule> {
void handlCoverClick(V2TimConversation conv) async { void handlCoverClick(V2TimConversation conv) async {
// VideoMsg, // VideoMsg,
final userId = conv.userID; final userId = conv.userID;
final currentVideo = videoList[videoModuleController.videoPlayIndex.value]; final currentVideo = videoList[videoModuleController.videoPlayFriend.value];
logger.w(currentVideo); logger.w(currentVideo);
final img = (currentVideo['cover'] != null && currentVideo['cover'].toString().isNotEmpty) ? currentVideo['cover'] : currentVideo['firstFrameImg']; final img = (currentVideo['cover'] != null && currentVideo['cover'].toString().isNotEmpty) ? currentVideo['cover'] : currentVideo['firstFrameImg'];
final url = currentVideo['url']; final url = currentVideo['url'];
@ -1054,7 +1054,7 @@ class _FriendModuleState extends State<FriendModule> {
scrollDirection: Axis.vertical, scrollDirection: Axis.vertical,
controller: pageController, controller: pageController,
onPageChanged: (index) async { onPageChanged: (index) async {
videoModuleController.updateVideoPlayIndex(index); videoModuleController.updateVideoPlayIndex1(index);
setState(() { setState(() {
sliderValue = 0.0; sliderValue = 0.0;
sliderDraging = false; sliderDraging = false;
@ -1086,7 +1086,7 @@ class _FriendModuleState extends State<FriendModule> {
child: Stack( child: Stack(
children: [ children: [
Visibility( Visibility(
visible: videoModuleController.videoPlayIndex.value == index && position > Duration.zero, visible: videoModuleController.videoPlayFriend.value == index && position > Duration.zero,
child: Video( child: Video(
controller: videoController, controller: videoController,
fit: isHorizontal ? BoxFit.contain : BoxFit.cover, fit: isHorizontal ? BoxFit.contain : BoxFit.cover,
@ -1094,7 +1094,7 @@ class _FriendModuleState extends State<FriendModule> {
), ),
), ),
AnimatedOpacity( 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), duration: Duration(milliseconds: 50),
child: Image.network( child: Image.network(
videoList[index]['firstFrameImg'] ?? 'https://wuzhongjie.com.cn/download/logo.png', videoList[index]['firstFrameImg'] ?? 'https://wuzhongjie.com.cn/download/logo.png',
@ -1148,7 +1148,7 @@ class _FriendModuleState extends State<FriendModule> {
onTap: () async { onTap: () async {
player.pause(); player.pause();
// Vloger // Vloger
final vloggerId = videoList[videoModuleController.videoPlayIndex.value]['memberId']; final vloggerId = videoList[videoModuleController.videoPlayFriend.value]['memberId'];
final result = await Get.toNamed('/vloger', arguments: {'memberId': vloggerId}); final result = await Get.toNamed('/vloger', arguments: {'memberId': vloggerId});
if (result != null) { if (result != null) {
// //
@ -1282,7 +1282,7 @@ class _FriendModuleState extends State<FriendModule> {
onTap: () async { onTap: () async {
player.pause(); 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) { if (result != null) {
player.play(); player.play();
} }
@ -1298,9 +1298,9 @@ class _FriendModuleState extends State<FriendModule> {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
if (videoModuleController.videoPlayIndex.value < videoList.length) if (videoModuleController.videoPlayFriend.value < videoList.length)
Text( Text(
'@${videoList[videoModuleController.videoPlayIndex.value]['nickname'] ?? '未知'}', '@${videoList[videoModuleController.videoPlayFriend.value]['nickname'] ?? '未知'}',
style: const TextStyle(color: Colors.white, fontSize: 16.0), style: const TextStyle(color: Colors.white, fontSize: 16.0),
) )
else else
@ -1309,10 +1309,10 @@ class _FriendModuleState extends State<FriendModule> {
style: const TextStyle(color: Colors.white, fontSize: 16.0), style: const TextStyle(color: Colors.white, fontSize: 16.0),
), ),
// LayoutBuilder // LayoutBuilder
if (videoModuleController.videoPlayIndex.value < videoList.length) if (videoModuleController.videoPlayFriend.value < videoList.length)
LayoutBuilder( LayoutBuilder(
builder: (context, constraints) { builder: (context, constraints) {
final text = videoList[videoModuleController.videoPlayIndex.value]['title'] ?? '未知'; final text = videoList[videoModuleController.videoPlayFriend.value]['title'] ?? '未知';
final span = TextSpan( final span = TextSpan(
text: text, text: text,
style: const TextStyle(color: Colors.white, fontSize: 14.0), style: const TextStyle(color: Colors.white, fontSize: 14.0),
@ -1330,8 +1330,8 @@ class _FriendModuleState extends State<FriendModule> {
children: [ children: [
Text( Text(
text, text,
maxLines: videoList[videoModuleController.videoPlayIndex.value]['expanded'] ? null : 3, maxLines: videoList[videoModuleController.videoPlayFriend.value]['expanded'] ? null : 3,
overflow: videoList[videoModuleController.videoPlayIndex.value]['expanded'] overflow: videoList[videoModuleController.videoPlayFriend.value]['expanded']
? TextOverflow.visible ? TextOverflow.visible
: TextOverflow.ellipsis, : TextOverflow.ellipsis,
style: const TextStyle(color: Colors.white, fontSize: 14.0), style: const TextStyle(color: Colors.white, fontSize: 14.0),
@ -1342,12 +1342,12 @@ class _FriendModuleState extends State<FriendModule> {
child: GestureDetector( child: GestureDetector(
onTap: () { onTap: () {
setState(() { setState(() {
videoList[videoModuleController.videoPlayIndex.value]['expanded'] = videoList[videoModuleController.videoPlayFriend.value]['expanded'] =
!videoList[videoModuleController.videoPlayIndex.value]['expanded']; !videoList[videoModuleController.videoPlayFriend.value]['expanded'];
}); });
}, },
child: Text( child: Text(
videoList[videoModuleController.videoPlayIndex.value]['expanded'] ? '收起' : '展开更多', videoList[videoModuleController.videoPlayFriend.value]['expanded'] ? '收起' : '展开更多',
textAlign: TextAlign.right, textAlign: TextAlign.right,
style: const TextStyle( style: const TextStyle(
color: Colors.white, color: Colors.white,
@ -1370,7 +1370,7 @@ class _FriendModuleState extends State<FriendModule> {
left: 6.0, left: 6.0,
right: 6.0, right: 6.0,
child: Visibility( child: Visibility(
visible: videoModuleController.videoPlayIndex.value == index && position > Duration.zero, visible: videoModuleController.videoPlayFriend.value == index && position > Duration.zero,
child: Listener( child: Listener(
child: SliderTheme( child: SliderTheme(
data: SliderThemeData( data: SliderThemeData(