diff --git a/CHANGELOG.md b/CHANGELOG.md index ede57e6..88c1dc8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,8 @@ +## 1.5.0+1 + +* Fix: Video message oversize. + ## 1.5.0 * Add: New configuration `defaultAvatarAssetPath` on global `TIMUIKitConfig`, aiming to define the default avatar. diff --git a/example/pubspec.lock b/example/pubspec.lock index 8f10723..e8ee21c 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -379,14 +379,6 @@ packages: url: "https://pub.dev" source: hosted version: "0.0.15" - flutter_screenutil: - dependency: transitive - description: - name: flutter_screenutil - sha256: "8e049ecdc1a62c90e6bf0e9c8398ace8dde81b92889c70cfe06281d79d59113a" - url: "https://pub.dev" - source: hosted - version: "5.6.1" flutter_slidable_for_tencent_im: dependency: transitive description: @@ -1088,7 +1080,7 @@ packages: path: ".." relative: true source: path - version: "1.4.0" + version: "1.5.0+1" tencent_extended_text: dependency: transitive description: @@ -1117,10 +1109,10 @@ packages: dependency: transitive description: name: tencent_im_base - sha256: "2c8fd0f47d6b22d234f24042c5ac66febe6d71b7c9e131c95031e931efe9aa7b" + sha256: bbd2d70c82b018ce86c421f0b4eb02f650456d0bbd7ea5558110139c7b04c4b4 url: "https://pub.dev" source: hosted - version: "1.0.20" + version: "1.0.21" tencent_im_sdk_plugin_platform_interface: dependency: transitive description: diff --git a/lib/ui/views/TIMUIKitChat/TIMUIKItMessageList/tim_uikit_chat_history_message_list.dart b/lib/ui/views/TIMUIKitChat/TIMUIKItMessageList/tim_uikit_chat_history_message_list.dart index 294c688..59aee73 100644 --- a/lib/ui/views/TIMUIKitChat/TIMUIKItMessageList/tim_uikit_chat_history_message_list.dart +++ b/lib/ui/views/TIMUIKitChat/TIMUIKItMessageList/tim_uikit_chat_history_message_list.dart @@ -354,7 +354,7 @@ class _TIMUIKitHistoryMessageListState } return Container( - color: theme.chatBgColor, + color: theme.chatBgColor , child: Stack( alignment: Alignment.topCenter, children: [ diff --git a/lib/ui/views/TIMUIKitChat/TIMUIKitMessageItem/tim_uikit_chat_image_elem.dart b/lib/ui/views/TIMUIKitChat/TIMUIKitMessageItem/tim_uikit_chat_image_elem.dart index 990f298..a7cf540 100644 --- a/lib/ui/views/TIMUIKitChat/TIMUIKitMessageItem/tim_uikit_chat_image_elem.dart +++ b/lib/ui/views/TIMUIKitChat/TIMUIKitMessageItem/tim_uikit_chat_image_elem.dart @@ -13,7 +13,6 @@ import 'dart:typed_data'; import 'package:cached_network_image/cached_network_image.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:loading_animation_widget/loading_animation_widget.dart'; import 'package:path_provider/path_provider.dart'; import 'package:provider/provider.dart'; @@ -230,15 +229,6 @@ class _TIMUIKitImageElem extends TIMUIKitState { return; } - getImgWidthAndHeight( - BoxConstraints constraints, double height, double width) { - // 消息列表展示缩略图的大小 - double hwrate = height / width; - double curWidth = min(width, constraints.maxWidth * 0.5); - double curHeight = curWidth * hwrate; - return {height: curHeight, width: curWidth}; - } - Future _saveImg(TUITheme theme) async { String? path = widget.message.imageElem!.path; if (path != null && PlatformUtils().isWeb diff --git a/lib/ui/views/TIMUIKitChat/TIMUIKitMessageItem/tim_uikit_chat_sound_elem.dart b/lib/ui/views/TIMUIKitChat/TIMUIKitMessageItem/tim_uikit_chat_sound_elem.dart index 33e8aac..26d15c7 100644 --- a/lib/ui/views/TIMUIKitChat/TIMUIKitMessageItem/tim_uikit_chat_sound_elem.dart +++ b/lib/ui/views/TIMUIKitChat/TIMUIKitMessageItem/tim_uikit_chat_sound_elem.dart @@ -99,10 +99,12 @@ class _TIMUIKitSoundElemState extends TIMUIKitState { widget.message.soundElem!.url == '') { final response = await _messageService.getMessageOnlineUrl( msgID: widget.message.msgID!); - widget.message.soundElem = response.data!.soundElem; - Future.delayed(const Duration(microseconds: 10), () { - setState(() => stateElement = response.data!.soundElem!); - }); + if(response.data != null){ + widget.message.soundElem = response.data!.soundElem; + Future.delayed(const Duration(microseconds: 10), () { + setState(() => stateElement = response.data!.soundElem!); + }); + } } if (!PlatformUtils().isWeb) { if (widget.message.soundElem!.localUrl == null || diff --git a/lib/ui/views/TIMUIKitChat/TIMUIKitMessageItem/tim_uikit_chat_video_elem.dart b/lib/ui/views/TIMUIKitChat/TIMUIKitMessageItem/tim_uikit_chat_video_elem.dart index ec90c39..6a91cdc 100644 --- a/lib/ui/views/TIMUIKitChat/TIMUIKitMessageItem/tim_uikit_chat_video_elem.dart +++ b/lib/ui/views/TIMUIKitChat/TIMUIKitMessageItem/tim_uikit_chat_video_elem.dart @@ -3,7 +3,6 @@ import 'dart:math'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:loading_animation_widget/loading_animation_widget.dart'; import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_base.dart'; import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_state.dart'; @@ -134,10 +133,12 @@ class _TIMUIKitVideoElemState extends TIMUIKitState { widget.message.videoElem!.videoUrl == '') { final response = await _messageService.getMessageOnlineUrl( msgID: widget.message.msgID!); - widget.message.videoElem = response.data!.videoElem; - Future.delayed(const Duration(microseconds: 10), () { - setState(() => stateElement = response.data!.videoElem!); - }); + if(response.data != null){ + widget.message.videoElem = response.data!.videoElem; + Future.delayed(const Duration(microseconds: 10), () { + setState(() => stateElement = response.data!.videoElem!); + }); + } } if (!PlatformUtils().isWeb) { if (widget.message.videoElem!.localVideoUrl == null || @@ -185,95 +186,83 @@ class _TIMUIKitVideoElemState extends TIMUIKitState { ), ); }, - child: ScreenUtilInit( - builder: (BuildContext context, Widget? child) { - return Hero( - tag: heroTag, - child: TIMUIKitMessageReactionWrapper( - chatModel: widget.chatModel, - message: widget.message, - isShowJump: widget.isShowJump, - isShowMessageReaction: widget.isShowMessageReaction ?? true, - clearJump: widget.clearJump, - isFromSelf: widget.message.isSelf ?? true, - child: ClipRRect( - borderRadius: const BorderRadius.all(Radius.circular(5)), - child: LayoutBuilder(builder: - (BuildContext context, BoxConstraints constraints) { - double positionRadio = 0.56; - if (stateElement.snapshotWidth != null && - stateElement.snapshotHeight != null && - stateElement.snapshotWidth != 0 && - stateElement.snapshotHeight != 0) { - positionRadio = (stateElement.snapshotWidth! / - stateElement.snapshotHeight!); - } + child: Hero( + tag: heroTag, + child: TIMUIKitMessageReactionWrapper( + chatModel: widget.chatModel, + message: widget.message, + isShowJump: widget.isShowJump, + isShowMessageReaction: widget.isShowMessageReaction ?? true, + clearJump: widget.clearJump, + isFromSelf: widget.message.isSelf ?? true, + child: ClipRRect( + borderRadius: const BorderRadius.all(Radius.circular(5)), + child: LayoutBuilder(builder: + (BuildContext context, BoxConstraints constraints) { + double positionRadio = 0.56; + if (stateElement.snapshotWidth != null && + stateElement.snapshotHeight != null && + stateElement.snapshotWidth != 0 && + stateElement.snapshotHeight != 0) { + positionRadio = (stateElement.snapshotWidth! / + stateElement.snapshotHeight!); + } - return ConstrainedBox( - constraints: BoxConstraints( - maxWidth: PlatformUtils().isWeb - ? 300 - : constraints.maxWidth * 0.5, - maxHeight: min(constraints.maxHeight * 0.8, 300), - minHeight: 20, - minWidth: 20), - child: AspectRatio( - aspectRatio: positionRadio, - child: Stack( - children: [ - if (stateElement.snapshotUrl != null || - stateElement.snapshotUrl != null) - AspectRatio( - aspectRatio: positionRadio, - child: Container( - decoration: const BoxDecoration( - color: Colors.transparent), - ), - ), - Row( - children: [ - Expanded( - child: generateSnapshot( - theme, - stateElement.snapshotHeight ?? - 100)) - ], - ), - if (widget.message.status != - MessageStatus - .V2TIM_MSG_STATUS_SENDING && - (stateElement.snapshotUrl != null || - stateElement.snapshotPath != - null) && - stateElement.videoPath != null || - stateElement.videoUrl != null) - Positioned.fill( - // alignment: Alignment.center, - child: Center( - child: Image.asset('images/play.png', - package: 'tencent_cloud_chat_uikit', - height: 64)), - ), - Positioned( - right: 10, - bottom: 10, - child: Text( - MessageUtils.formatVideoTime(widget - .message - .videoElem - ?.duration ?? - 0) - .toString(), - style: const TextStyle( - color: Colors.white, - fontSize: 12))), + return ConstrainedBox( + constraints: BoxConstraints( + maxWidth: PlatformUtils().isWeb + ? 300 + : constraints.maxWidth * 0.5, + maxHeight: min(constraints.maxHeight * 0.8, 300), + minHeight: 20, + minWidth: 20), + child: AspectRatio( + aspectRatio: positionRadio, + child: Stack( + children: [ + Row( + children: [ + Expanded( + child: generateSnapshot( + theme, + stateElement.snapshotHeight ?? + 100)) ], ), - )); - }), - ))); - }, - ), + if (widget.message.status != + MessageStatus + .V2TIM_MSG_STATUS_SENDING && + (stateElement.snapshotUrl != null || + stateElement.snapshotPath != + null) && + stateElement.videoPath != null || + stateElement.videoUrl != null) + Positioned.fill( + // alignment: Alignment.center, + child: Center( + child: Image.asset('images/play.png', + package: 'tencent_cloud_chat_uikit', + height: 64)), + ), + Positioned( + right: 10, + bottom: 10, + child: Text( + MessageUtils.formatVideoTime(widget + .message + .videoElem + ?.duration ?? + 0) + .toString(), + style: const TextStyle( + color: Colors.white, + fontSize: 12))), + ], + ), + ) + ); + }), + ))), ); } } diff --git a/pubspec.lock b/pubspec.lock index 67dd39b..90ad3f9 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -443,14 +443,6 @@ packages: url: "https://pub.dev" source: hosted version: "0.0.15" - flutter_screenutil: - dependency: "direct main" - description: - name: flutter_screenutil - sha256: "8e049ecdc1a62c90e6bf0e9c8398ace8dde81b92889c70cfe06281d79d59113a" - url: "https://pub.dev" - source: hosted - version: "5.6.1" flutter_slidable_for_tencent_im: dependency: "direct main" description: @@ -1225,10 +1217,10 @@ packages: dependency: "direct main" description: name: tencent_im_base - sha256: "2c8fd0f47d6b22d234f24042c5ac66febe6d71b7c9e131c95031e931efe9aa7b" + sha256: bbd2d70c82b018ce86c421f0b4eb02f650456d0bbd7ea5558110139c7b04c4b4 url: "https://pub.dev" source: hosted - version: "1.0.20" + version: "1.0.21" tencent_im_sdk_plugin_platform_interface: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 2989f43..5389c49 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: tencent_cloud_chat_uikit description: Chat UI components library and basic chat business logic for Tencent Cloud Chat, helping you build In-APP Chat module easily. -version: 1.5.0 +version: 1.5.0+1 homepage: https://www.tencentcloud.com/products/im?from=pub repository: https://github.com/TencentCloud/chat-uikit-flutter documentation: https://comm.qq.com/im/doc/flutter/en/TUIKit/readme.html @@ -57,12 +57,11 @@ dependencies: loading_animation_widget: ^1.1.0+3 permission_handler: ^10.0.0 tuple: ^2.0.0 - flutter_screenutil: ^5.5.3+2 flutter_markdown: ^0.6.9 url_launcher: ^6.1.4 universal_html: ^2.0.8 link_preview_generator: ^1.2.0 - tencent_im_base: ^1.0.20 + tencent_im_base: ^1.0.21 disk_space: ^0.2.1 http: ^0.13.5 crypto: ^3.0.2