diff --git a/wgshare/lib/common/models/meeting_room_msg.dart b/wgshare/lib/common/models/meeting_room_msg.dart index 9043751..1c85803 100644 --- a/wgshare/lib/common/models/meeting_room_msg.dart +++ b/wgshare/lib/common/models/meeting_room_msg.dart @@ -14,7 +14,9 @@ class MeetingRoomMsg extends Object{ // 0:别人,1:自己 int source; - MeetingRoomMsg(this.uid,this.userName,this.message,this.source); + String time; + + MeetingRoomMsg(this.uid,this.userName,this.message,this.source,this.time); factory MeetingRoomMsg.fromJson(Map srcJson) => _$MeetingRoomMsgFromJson(srcJson); diff --git a/wgshare/lib/common/models/meeting_room_user.dart b/wgshare/lib/common/models/meeting_room_user.dart index e53a3be..b8948d5 100644 --- a/wgshare/lib/common/models/meeting_room_user.dart +++ b/wgshare/lib/common/models/meeting_room_user.dart @@ -40,7 +40,7 @@ class MeetingRoomUser extends Object{ double? volume = 0.0; @JsonKey(name: 'enableShare') - bool? enableShare; + bool? enableShare = false; MeetingRoomUser(this.uid,this.connectId,this.account,this.enableMicr,this.enableCamera,this.screenShareId,this.userName,this.roleId,this.roleName,this.isRoomManager,this.volume,this.enableShare); diff --git a/wgshare/lib/pages/metting/meeting_main_logic.dart b/wgshare/lib/pages/metting/meeting_main_logic.dart index 6056160..55ffb5e 100644 --- a/wgshare/lib/pages/metting/meeting_main_logic.dart +++ b/wgshare/lib/pages/metting/meeting_main_logic.dart @@ -1,6 +1,7 @@ import 'dart:async'; import 'dart:convert'; import 'package:agora_rtc_engine/agora_rtc_engine.dart'; +import 'package:date_format/date_format.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/foundation.dart'; import 'package:get/get.dart'; @@ -235,7 +236,6 @@ class MeetingMainLogic extends GetxController with RequestToolMixin { state.remoteUid.value = ""; changePageState(1); } - update(); } } else { if(state.remoteUid.value == UserStore.to.userInfoEntity.value!.screenShareId){ @@ -249,6 +249,7 @@ class MeetingMainLogic extends GetxController with RequestToolMixin { } } } + update(); } /// 设置当前全员观看主播 @@ -490,8 +491,8 @@ class MeetingMainLogic extends GetxController with RequestToolMixin { // var jsonStr = const Utf8Decoder().convert(json.encode(e).runes.toList()); var jsonStr = json.encode(e); List list = json.decode(jsonStr); - MeetingRoomMsg meetingRoomMsg = - MeetingRoomMsg(list[0], list[1], list[2], 0); + DateTime dateTime = DateTime.now(); + MeetingRoomMsg meetingRoomMsg = MeetingRoomMsg(list[0], list[1], list[2], 0, formatDate(dateTime, [HH, ':', nn, ':', ss])); state.meetingRoomMsgs.value.add(meetingRoomMsg); update(); Future.delayed(const Duration(milliseconds: 100), () { @@ -589,11 +590,12 @@ class MeetingMainLogic extends GetxController with RequestToolMixin { /// 会议室发送消息 Future sendMsg(String msg) async { + DateTime dateTime = DateTime.now(); MeetingRoomMsg meetingRoomMsg = MeetingRoomMsg( UserStore.to.userInfoEntity.value!.uid, UserStore.to.userInfoEntity.value!.userName, msg, - 1); + 1, formatDate(dateTime, [HH, ':', nn, ':', ss])); state.meetingRoomMsgs.value.add(meetingRoomMsg); update(); Future.delayed(const Duration(milliseconds: 100), () { @@ -654,6 +656,14 @@ class MeetingMainLogic extends GetxController with RequestToolMixin { // 远端用户或主播离开当前会议室回调-主播角色才能接收该回调 onUserOffline: (RtcConnection connection, int remoteUid, UserOfflineReasonType reason) async { + // 判断是否用户取消了共享 + if(remoteUid.toString().length == 9){ + for (var i = 0; i < state.cacheUsers.value.length; i++) { + if (remoteUid.toString() == state.cacheUsers.value[i].screenShareId) { + state.cacheUsers.value[i].enableShare = false; + } + } + } debugPrint("wgs输出===:RTC-远端用户或主播离开会议室,用户或主机的ID:$remoteUid"); }, diff --git a/wgshare/lib/pages/metting/meeting_main_view.dart b/wgshare/lib/pages/metting/meeting_main_view.dart index 4e62bdf..318131d 100644 --- a/wgshare/lib/pages/metting/meeting_main_view.dart +++ b/wgshare/lib/pages/metting/meeting_main_view.dart @@ -1136,12 +1136,18 @@ class MeetingMainPageState extends State { ColorUtil.Color_244_244_244), ), ), - Text( - state.users.value[index].userName, - style: TextStyle( - fontSize: 14.sp, - fontWeight: FontWeight.w600, - color: ColorUtil.Color_243_243_243), + Container( + width: 76, + margin: const EdgeInsets.only(left: 6), + child: Text( + state.users.value[index].userName, + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 14.sp, + fontWeight: FontWeight.w600, + color: ColorUtil.Color_243_243_243), + ), ), SizedBox(width: 8.w), Visibility( @@ -1371,10 +1377,23 @@ class MeetingMainPageState extends State { children: [ Container( margin: const EdgeInsets.only(left: 6), - child: Text( - state.meetingRoomMsgs.value[index].userName, - style: TextStyle( - fontSize: 10.sp, color: ColorUtil.Color_202_202_202), + child: Text.rich( + TextSpan( + children: [ + TextSpan( + text: state.meetingRoomMsgs.value[index].userName, + style: TextStyle( + fontSize: 12.sp, color: ColorUtil.Color_202_202_202), + ), + TextSpan( + text: " ${state.meetingRoomMsgs.value[index].time}", + style: TextStyle( + fontSize: 10.sp, color: ColorUtil.Color_202_202_202 + ), + ), + ], + ), + textAlign: TextAlign.left, ), ), Container( @@ -1383,9 +1402,9 @@ class MeetingMainPageState extends State { left: 18, right: 18, top: 10, bottom: 10), decoration: const BoxDecoration( borderRadius: BorderRadius.only( - bottomLeft: Radius.circular(99), - topRight: Radius.circular(99), - bottomRight: Radius.circular(99)), + bottomLeft: Radius.circular(30), + topRight: Radius.circular(30), + bottomRight: Radius.circular(30)), color: ColorUtil.Color_53_53_53, ), child: Text( @@ -1417,10 +1436,23 @@ class MeetingMainPageState extends State { children: [ Container( margin: const EdgeInsets.only(right: 6), - child: Text( - state.meetingRoomMsgs.value[index].userName, - style: TextStyle( - fontSize: 10.sp, color: ColorUtil.Color_202_202_202), + child: Text.rich( + TextSpan( + children: [ + TextSpan( + text: "${state.meetingRoomMsgs.value[index].time} ", + style: TextStyle( + fontSize: 10.sp, color: ColorUtil.Color_202_202_202 + ), + ), + TextSpan( + text: state.meetingRoomMsgs.value[index].userName, + style: TextStyle( + fontSize: 12.sp, color: ColorUtil.Color_202_202_202), + ), + ], + ), + textAlign: TextAlign.right, ), ), Container( @@ -1429,9 +1461,9 @@ class MeetingMainPageState extends State { left: 18, right: 18, top: 10, bottom: 10), decoration: const BoxDecoration( borderRadius: BorderRadius.only( - topLeft: Radius.circular(99), - bottomLeft: Radius.circular(99), - bottomRight: Radius.circular(99)), + topLeft: Radius.circular(30), + bottomLeft: Radius.circular(30), + bottomRight: Radius.circular(30)), color: ColorUtil.Color_85_117_242, ), child: Text( @@ -1697,6 +1729,8 @@ class MeetingMainPageState extends State { width: 70, child: Text( state.cacheUsers.value[index].userName, + maxLines: 1, + overflow: TextOverflow.ellipsis, style: TextStyle( fontSize: 12.sp, color: ColorUtil.Color_255_255_255), @@ -1717,6 +1751,8 @@ class MeetingMainPageState extends State { width: 70, child: Text( state.cacheUsers.value[index].userName, + maxLines: 1, + overflow: TextOverflow.ellipsis, style: TextStyle( fontSize: 12.sp, color: ColorUtil.Color_255_255_255), diff --git a/wgshare/pubspec.lock b/wgshare/pubspec.lock index a9d7c01..06f1bec 100644 --- a/wgshare/pubspec.lock +++ b/wgshare/pubspec.lock @@ -214,6 +214,14 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "2.3.7" + date_format: + dependency: "direct main" + description: + name: date_format + sha256: a48254e60bdb7f1d5a15cac7f86e37491808056c0a99dbdc850841def4754ddc + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.0.9" device_info_plus: dependency: "direct main" description: diff --git a/wgshare/pubspec.yaml b/wgshare/pubspec.yaml index 07324ee..e44c5cf 100644 --- a/wgshare/pubspec.yaml +++ b/wgshare/pubspec.yaml @@ -89,6 +89,9 @@ dependencies: #webview_flutter: ^3.0.4 flutter_inappwebview: ^6.1.5 + # 时间组件 + date_format: ^2.0.9 + dev_dependencies: flutter_test: sdk: flutter