From be65bea65e5e8e65ae28a732cca33b700d93a8db Mon Sep 17 00:00:00 2001 From: anonymous Date: Wed, 31 May 2023 16:10:30 +0800 Subject: [PATCH] Flutter TUIKit 2.1.0+2 --- CHANGELOG.md | 10 +++++++ example/pubspec.lock | 54 ++++++++++++++++++++++++++---------- lib/ui/widgets/textSize.dart | 52 +++++++++++++++++++--------------- pubspec.lock | 40 ++++++++++++++++++++------ pubspec.yaml | 6 ++-- 5 files changed, 113 insertions(+), 49 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 42ead16..ebbd2c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ +## 2.1.0+2 + +### Improvements + +* Upgraded several dependencies to resolve conflicts with the Kotlin Gradle plugin. + +### Bug Fixes + +* Fixed an issue causing the message list to be displayed inaccurately when it contains a file without a suffix. + ## 2.1.0+1 ### Improvements diff --git a/example/pubspec.lock b/example/pubspec.lock index 6d07ec2..72dea3f 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -466,10 +466,10 @@ packages: dependency: transitive description: name: flutter_markdown - sha256: "818cf6c28377ba2c91ed283c96fd712e9c175dd2d2488eb7fc93b6afb9ad2e08" + sha256: dc6d5258653f6857135b32896ccda7f7af0c54dcec832495ad6835154c6c77c0 url: "https://pub.dev" source: hosted - version: "0.6.13+1" + version: "0.6.15" flutter_plugin_android_lifecycle: dependency: transitive description: @@ -482,10 +482,10 @@ packages: dependency: transitive description: name: flutter_plugin_record_plus - sha256: e75a5265d37617327d8756d1c4eb7766625489fc1c5bc437fdfd827538285ee4 + sha256: "6e515bb54b996b64d177d7e8d252e0b03109e70f38b11bc1172aa56f530950c9" url: "https://pub.dev" source: hosted - version: "0.0.15" + version: "0.0.16" flutter_slidable_for_tencent_im: dependency: transitive description: @@ -498,10 +498,10 @@ packages: dependency: transitive description: name: flutter_svg - sha256: "6ff9fa12892ae074092de2fa6a9938fb21dbabfdaa2ff57dc697ff912fc8d4b2" + sha256: "6ff8c902c8056af9736de2689f63f81c42e2d642b9f4c79dbf8790ae48b63012" url: "https://pub.dev" source: hosted - version: "1.1.6" + version: "2.0.6" flutter_test: dependency: "direct dev" description: flutter @@ -572,10 +572,10 @@ packages: dependency: transitive description: name: image_gallery_saver - sha256: be812580c7a320d3bf583af89cac6b376f170d48000aca75215a73285a3223a0 + sha256: "009b7722cd8507fd72c7f2cb7cbc46d6e15ad0895469cfcc39a10f86e3556979" url: "https://pub.dev" source: hosted - version: "1.7.1" + version: "2.0.1" image_picker: dependency: transitive description: @@ -684,10 +684,10 @@ packages: dependency: transitive description: name: markdown - sha256: c2b81e184067b41d0264d514f7cdaa2c02d38511e39d6521a1ccc238f6d7b3f2 + sha256: "8e332924094383133cee218b676871f42db2514f1f6ac617b6cf6152a7faab8e" url: "https://pub.dev" source: hosted - version: "6.0.1" + version: "7.1.0" matcher: dependency: transitive description: @@ -892,10 +892,10 @@ packages: dependency: transitive description: name: petitparser - sha256: "49392a45ced973e8d94a85fdb21293fbb40ba805fc49f2965101ae748a3683b4" + sha256: cb3798bef7fc021ac45b308f4b51208a152792445cce0448c9a4ba5879dd8750 url: "https://pub.dev" source: hosted - version: "5.1.0" + version: "5.4.0" photo_manager: dependency: transitive description: @@ -1139,7 +1139,7 @@ packages: path: ".." relative: true source: path - version: "2.1.0" + version: "2.1.0+1" tencent_cloud_uikit_core: dependency: transitive description: @@ -1340,6 +1340,30 @@ packages: url: "https://pub.dev" source: hosted version: "3.0.7" + vector_graphics: + dependency: transitive + description: + name: vector_graphics + sha256: b96f10cbdfcbd03a65758633a43e7d04574438f059b1043104b5d61b23d38a4f + url: "https://pub.dev" + source: hosted + version: "1.1.6" + vector_graphics_codec: + dependency: transitive + description: + name: vector_graphics_codec + sha256: "57a8e6e24662a3bdfe3b3d61257db91768700c0b8f844e235877b56480f31c69" + url: "https://pub.dev" + source: hosted + version: "1.1.6" + vector_graphics_compiler: + dependency: transitive + description: + name: vector_graphics_compiler + sha256: "7430f5d834d0db4560d7b19863362cd892f1e52b43838553a3c5cdfc9ab28e5b" + url: "https://pub.dev" + source: hosted + version: "1.1.6" vector_math: dependency: transitive description: @@ -1456,10 +1480,10 @@ packages: dependency: transitive description: name: xml - sha256: "979ee37d622dec6365e2efa4d906c37470995871fe9ae080d967e192d88286b5" + sha256: "5bc72e1e45e941d825fd7468b9b4cc3b9327942649aeb6fc5cdbf135f0a86e84" url: "https://pub.dev" source: hosted - version: "6.2.2" + version: "6.3.0" yaml: dependency: transitive description: diff --git a/lib/ui/widgets/textSize.dart b/lib/ui/widgets/textSize.dart index 6f49560..f19a951 100644 --- a/lib/ui/widgets/textSize.dart +++ b/lib/ui/widgets/textSize.dart @@ -67,29 +67,35 @@ class _ExtendTextState extends State { int offset = widget.offset ?? 3; if (textwidth > widget.width) { int position = widget.text.lastIndexOf('.'); - String overflowtext = widget.overflowtext ?? '...'; - int overflowtextLength = overflowtext.length; - double singTextSize = textwidth / widget.text.length; - String newtext = - '${widget.text.substring(0, position - offset)}$overflowtext${widget.text.substring(position - offset, widget.text.length)}'; - position += overflowtextLength; - int number = ((textwidth - widget.width) / singTextSize).ceil(); - do { - int a = position - offset - overflowtextLength - number; - newtext = newtext.substring(0, a < 1 ? 1 : a) + - newtext.substring( - position - offset - overflowtextLength, newtext.length); - position -= number; - number = - ((TextSize.boundingTextSize(newtext, style).width - widget.width) / - singTextSize) - .ceil(); - if (a < 1 || number < 1) { - break; - } - } while ( - TextSize.boundingTextSize(newtext, style).width > widget.width - 20); - text = newtext; + if(position < 1){ + int numberOfCharsToRemove = ((textwidth - widget.width) / (style.fontSize ?? 14)).floor(); + String overflowText = widget.overflowtext ?? '...'; + text = widget.text.replaceRange(widget.text.length - numberOfCharsToRemove, widget.text.length, '') + overflowText; + }else{ + String overflowtext = widget.overflowtext ?? '...'; + int overflowtextLength = overflowtext.length; + double singTextSize = textwidth / widget.text.length; + String newtext = + '${widget.text.substring(0, position - offset)}$overflowtext${widget.text.substring(position - offset, widget.text.length)}'; + position += overflowtextLength; + int number = ((textwidth - widget.width) / singTextSize).ceil(); + do { + int a = position - offset - overflowtextLength - number; + newtext = newtext.substring(0, a < 1 ? 1 : a) + + newtext.substring( + position - offset - overflowtextLength, newtext.length); + position -= number; + number = + ((TextSize.boundingTextSize(newtext, style).width - widget.width) / + singTextSize) + .ceil(); + if (a < 1 || number < 1) { + break; + } + } while ( + TextSize.boundingTextSize(newtext, style).width > widget.width - 20); + text = newtext; + } } } diff --git a/pubspec.lock b/pubspec.lock index a140f2d..fac9857 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -530,10 +530,10 @@ packages: dependency: "direct main" description: name: flutter_markdown - sha256: "7b25c10de1fea883f3c4f9b8389506b54053cd00807beab69fd65c8653a2711f" + sha256: dc6d5258653f6857135b32896ccda7f7af0c54dcec832495ad6835154c6c77c0 url: "https://pub.dev" source: hosted - version: "0.6.14" + version: "0.6.15" flutter_plugin_android_lifecycle: dependency: transitive description: @@ -546,10 +546,10 @@ packages: dependency: "direct main" description: name: flutter_plugin_record_plus - sha256: e75a5265d37617327d8756d1c4eb7766625489fc1c5bc437fdfd827538285ee4 + sha256: "6e515bb54b996b64d177d7e8d252e0b03109e70f38b11bc1172aa56f530950c9" url: "https://pub.dev" source: hosted - version: "0.0.15" + version: "0.0.16" flutter_slidable_for_tencent_im: dependency: "direct main" description: @@ -562,10 +562,10 @@ packages: dependency: "direct main" description: name: flutter_svg - sha256: "6ff9fa12892ae074092de2fa6a9938fb21dbabfdaa2ff57dc697ff912fc8d4b2" + sha256: "6ff8c902c8056af9736de2689f63f81c42e2d642b9f4c79dbf8790ae48b63012" url: "https://pub.dev" source: hosted - version: "1.1.6" + version: "2.0.6" flutter_web_plugins: dependency: transitive description: flutter @@ -647,10 +647,10 @@ packages: dependency: "direct main" description: name: image_gallery_saver - sha256: be812580c7a320d3bf583af89cac6b376f170d48000aca75215a73285a3223a0 + sha256: "009b7722cd8507fd72c7f2cb7cbc46d6e15ad0895469cfcc39a10f86e3556979" url: "https://pub.dev" source: hosted - version: "1.7.1" + version: "2.0.1" image_picker: dependency: "direct main" description: @@ -1424,6 +1424,30 @@ packages: url: "https://pub.dev" source: hosted version: "3.0.7" + vector_graphics: + dependency: transitive + description: + name: vector_graphics + sha256: b96f10cbdfcbd03a65758633a43e7d04574438f059b1043104b5d61b23d38a4f + url: "https://pub.dev" + source: hosted + version: "1.1.6" + vector_graphics_codec: + dependency: transitive + description: + name: vector_graphics_codec + sha256: "57a8e6e24662a3bdfe3b3d61257db91768700c0b8f844e235877b56480f31c69" + url: "https://pub.dev" + source: hosted + version: "1.1.6" + vector_graphics_compiler: + dependency: transitive + description: + name: vector_graphics_compiler + sha256: "7430f5d834d0db4560d7b19863362cd892f1e52b43838553a3c5cdfc9ab28e5b" + url: "https://pub.dev" + source: hosted + version: "1.1.6" vector_math: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 54205a3..92a3e2b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: tencent_cloud_chat_uikit description: A powerful chat UI component library and business logic for Tencent Cloud Chat, creating seamless in-app chat modules for delightful user experiences. -version: 2.1.0+1 +version: 2.1.0+2 homepage: https://www.tencentcloud.com/products/im?from=pub repository: https://github.com/TencentCloud/tc-chat-uikit-flutter documentation: https://comm.qq.com/im/doc/flutter/en/TUIKit/readme.html @@ -32,11 +32,11 @@ dependencies: video_player: ^2.4.2 chewie_for_us: ^1.5.0 flutter_slidable_for_tencent_im: ^1.4.0 - flutter_plugin_record_plus: ^0.0.15 + flutter_plugin_record_plus: ^0.0.16 azlistview_all_platforms: ^2.1.2 lpinyin: ^2.0.3 transparent_image: ^2.0.0 - image_gallery_saver: ^1.7.1 + image_gallery_saver: ^2.0.1 path_provider: ^2.0.8 cached_network_image: ^3.2.0 shared_preferences: ^2.0.13