fix_朋友&关注
This commit is contained in:
parent
9902980bf8
commit
314aeddf23
@ -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',
|
||||
);
|
||||
|
||||
// 添加在线时监听器
|
||||
|
||||
@ -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<Layout> {
|
||||
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');
|
||||
|
||||
@ -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';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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<Chat> with SingleTickerProviderStateMixin {
|
||||
// 接收参数
|
||||
late final Rx<V2TimConversation> arguments;
|
||||
|
||||
String blackTxt = '拉黑';
|
||||
|
||||
late String selfUserId;
|
||||
|
||||
// 聊天消息模块
|
||||
@ -167,6 +170,65 @@ class _ChatState extends State<Chat> with SingleTickerProviderStateMixin {
|
||||
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 {
|
||||
String remark = '';
|
||||
@ -344,7 +406,8 @@ class _ChatState extends State<Chat> with SingleTickerProviderStateMixin {
|
||||
),
|
||||
SizedBox(width: 4),
|
||||
],
|
||||
Ink(
|
||||
Flexible(
|
||||
child: Ink(
|
||||
decoration: BoxDecoration(
|
||||
color: !(item.isSelf ?? false) ? Color(0xFFFFFFFF) : Color(0xFF89E45B),
|
||||
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 {
|
||||
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<ChatController>();
|
||||
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<ChatController>();
|
||||
// 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<Chat> 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<Chat> 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<Chat> 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<Chat> 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))),
|
||||
],
|
||||
);
|
||||
},
|
||||
|
||||
@ -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});
|
||||
@ -137,12 +131,18 @@ class _VideoPageState extends State<VideoPage> 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<VideoPage> 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);
|
||||
|
||||
@ -557,7 +557,7 @@ class _AttentionModuleState extends State<AttentionModule> {
|
||||
|
||||
// 页面controller
|
||||
late PageController pageController = PageController(
|
||||
initialPage: videoModuleController.videoPlayIndex.value,
|
||||
initialPage: videoModuleController.videoPlayIndexFoucs.value,
|
||||
viewportFraction: 1.0,
|
||||
);
|
||||
|
||||
@ -656,7 +656,7 @@ class _AttentionModuleState extends State<AttentionModule> {
|
||||
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<AttentionModule> {
|
||||
// 初始化播放器
|
||||
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<AttentionModule> {
|
||||
|
||||
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<AttentionModule> {
|
||||
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<AttentionModule> {
|
||||
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<AttentionModule> {
|
||||
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<AttentionModule> {
|
||||
),
|
||||
),
|
||||
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<AttentionModule> {
|
||||
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<AttentionModule> {
|
||||
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<AttentionModule> {
|
||||
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<AttentionModule> {
|
||||
'@未知',
|
||||
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<AttentionModule> {
|
||||
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<AttentionModule> {
|
||||
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<AttentionModule> {
|
||||
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(
|
||||
|
||||
@ -558,7 +558,7 @@ class _FriendModuleState extends State<FriendModule> {
|
||||
|
||||
// 页面controller
|
||||
late PageController pageController = PageController(
|
||||
initialPage: videoModuleController.videoPlayIndex.value,
|
||||
initialPage: videoModuleController.videoPlayFriend.value,
|
||||
viewportFraction: 1.0,
|
||||
);
|
||||
|
||||
@ -657,7 +657,7 @@ class _FriendModuleState extends State<FriendModule> {
|
||||
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<FriendModule> {
|
||||
// 初始化播放器
|
||||
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<FriendModule> {
|
||||
|
||||
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<FriendModule> {
|
||||
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<FriendModule> {
|
||||
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<FriendModule> {
|
||||
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<FriendModule> {
|
||||
),
|
||||
),
|
||||
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<FriendModule> {
|
||||
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<FriendModule> {
|
||||
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<FriendModule> {
|
||||
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<FriendModule> {
|
||||
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<FriendModule> {
|
||||
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<FriendModule> {
|
||||
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<FriendModule> {
|
||||
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(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user