refactor: use official upstream code for more panel and icon SVGs
- Replace tim_uikit_more_panel.dart with official upstream version - Replace images/photo.svg, images/screen.svg, images/file.svg with official upstream versions - Remove all local customizations to avoid compatibility issues - Official SVGs have proper fill attributes (#5C6168) ensuring correct rendering
This commit is contained in:
parent
46142714c9
commit
cc76651dba
|
|
@ -26,13 +26,13 @@
|
||||||
* `Positioned` 底部距离从 `20` 调整为 `50`。
|
* `Positioned` 底部距离从 `20` 调整为 `50`。
|
||||||
* `Positioned` 左右距离从 `20` 调整为 `10`。
|
* `Positioned` 左右距离从 `20` 调整为 `10`。
|
||||||
|
|
||||||
### `lib/ui/views/TIMUIKitChat/TIMUIKitTextField/tim_uikit_more_panel.dart`
|
### `lib/ui/views/TIMUIKitChat/TIMUIKitTextField/tim_uikit_more_panel.dart` 及相关 SVG
|
||||||
* **修改日期**: 2026-01-05
|
* **修改日期**: 2026-01-05
|
||||||
* **修改目的**: 修复底部"照片"、"文件"图标显示为纯黑色的问题。
|
* **修改目的**: 完全使用官方 upstream 版本,避免本地定制导致的兼容性问题。
|
||||||
* **详细改动**:
|
* **详细改动**:
|
||||||
* 将本地 `images/photo.svg` 替换为官方 SDK 的 `images/svg/send_image.svg`。
|
* 从 upstream/main 同步了 `tim_uikit_more_panel.dart` 的完整官方代码。
|
||||||
* 将本地 `images/file.svg` 替换为官方 SDK 的 `images/svg/send_file.svg`。
|
* 从 upstream/main 同步了 `images/photo.svg`、`images/screen.svg`、`images/file.svg` 官方资源。
|
||||||
* **原因**: 在上游同步时,本地 SVG 文件被覆盖为缺少 `fill` 属性的版本,导致渲染为黑色。
|
* 移除了之前的所有本地修改(包括使用 `images/svg/send_image.svg` 等的尝试)。
|
||||||
|
|
||||||
### `scripts/sync_from_upstream.sh`
|
### `scripts/sync_from_upstream.sh`
|
||||||
* **修改日期**: 2026-01-05
|
* **修改日期**: 2026-01-05
|
||||||
|
|
|
||||||
|
|
@ -1 +1,14 @@
|
||||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1755247071973" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2556" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M983.04 229.868308H563.928615a98.461538 98.461538 0 0 1-69.159384-28.376616L373.366154 81.683692A10.259692 10.259692 0 0 0 366.355692 78.769231H40.96C18.313846 78.769231 0 97.673846 0 121.028923v781.942154C0 926.326154 18.313846 945.230769 40.96 945.230769h942.08c22.646154 0 40.96-18.904615 40.96-42.259692V272.128c0-23.374769-18.313846-42.259692-40.96-42.259692z" p-id="2557"></path></svg>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="128px" height="128px" viewBox="0 0 128 128" version="1.1">
|
||||||
|
<title>编组 5</title>
|
||||||
|
<g id="当前版" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||||
|
<g id="更多" transform="translate(-399.000000, -1147.000000)">
|
||||||
|
<g id="编组-7" transform="translate(47.000000, 1147.000000)">
|
||||||
|
<g id="编组-5" transform="translate(352.000000, 0.000000)">
|
||||||
|
<rect id="矩形备份-45" fill="#FFFFFF" x="0" y="0" width="128" height="128" rx="20"></rect>
|
||||||
|
<path d="M55.145898,42 C56.2822142,42 57.3210036,42.6420071 57.8291796,43.6583592 L58.8944272,45.7888544 C59.5719952,47.1439905 60.9570477,48 62.472136,48 L87,48 C88.6568542,48 90,49.3431458 90,51 L90,83 C90,84.6568542 88.6568542,86 87,86 L41,86 C39.3431458,86 38,84.6568542 38,83 L38,45 C38,43.3431458 39.3431458,42 41,42 L55.145898,42 Z M82,54 L46,54 C44.8954305,54 44,54.8954305 44,56 C44,57.1045695 44.8954305,58 46,58 L46,58 L82,58 C83.1045695,58 84,57.1045695 84,56 C84,54.8954305 83.1045695,54 82,54 L82,54 Z" id="形状结合" fill="#5C6168"></path>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
|
|
||||||
|
Before Width: | Height: | Size: 724 B After Width: | Height: | Size: 1.2 KiB |
|
|
@ -1 +1,16 @@
|
||||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1755247075414" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2699" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M249.304615 632.595692a25.088 25.088 0 0 1 34.993231 0l160.925539 155.47077a88.969846 88.969846 0 0 0 62.030769 25.068307 89.009231 89.009231 0 0 0 62.030769-25.068307l54.350769-52.539077a38.931692 38.931692 0 0 1 54.153846-0.118154L946.510769 996.627692A168.231385 168.231385 0 0 1 854.390154 1024H169.412923C81.979077 1024 9.846154 957.499077 0.925538 872.329846l248.359385-239.734154zM854.488615 0C947.889231 0 1023.881846 76.012308 1024 169.432615v685.154462a168.369231 168.369231 0 0 1-31.015385 97.654154L722.510769 689.388308a102.675692 102.675692 0 0 0-71.640615-28.947693 102.656 102.656 0 0 0-71.640616 28.947693l-54.350769 52.539077c-9.846154 9.491692-25.206154 9.491692-35.052307 0l-160.886154-155.47077a88.989538 88.989538 0 0 0-62.050462-25.048615c-23.236923 0-45.331692 8.920615-62.030769 25.048615L0 784.167385V169.432615C0 76.012308 76.012308 0 169.393231 0h685.095384z m-164.253538 177.329231c-91.785846 0-166.518154 74.752-166.518154 166.557538 0 91.805538 74.732308 166.577231 166.518154 166.577231s166.537846-74.771692 166.537846-166.596923c0-91.785846-74.752-166.537846-166.537846-166.537846z m0 64.118154a102.537846 102.537846 0 0 1 102.439385 102.439384 102.478769 102.478769 0 0 1-102.419693 102.459077 102.498462 102.498462 0 0 1-102.439384-102.459077 102.557538 102.557538 0 0 1 102.439384-102.439384z" p-id="2700"></path></svg>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="128px" height="128px" viewBox="0 0 128 128" version="1.1">
|
||||||
|
<title>编组 5</title>
|
||||||
|
<g id="当前版" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||||
|
<g id="更多" transform="translate(-223.000000, -1147.000000)">
|
||||||
|
<g id="编组-7" transform="translate(47.000000, 1147.000000)">
|
||||||
|
<g id="编组-5" transform="translate(176.000000, 0.000000)">
|
||||||
|
<rect id="矩形备份-45" fill="#FFFFFF" x="0" y="0" width="128" height="128" rx="20"></rect>
|
||||||
|
<g id="编组-4" transform="translate(37.999754, 44.000000)" fill="#5C6168">
|
||||||
|
<path d="M14.7827779,20.3047469 C15.3170315,19.8659839 16.0901816,19.8418682 16.6534183,20.2642957 L16.6534183,20.2642957 L42.967,40 L4.00024625,40 C1.79110725,40 0.000246247657,38.209139 0.000246247657,36 L0.000887612509,34.9779328 C0.151240169,34.8917402 0.292787062,34.7844307 0.421213562,34.6560042 L0.421213562,34.6560042 L14.6721151,20.4051026 Z M48.0002462,0 C50.2093852,-4.05812251e-16 52.0002462,1.790861 52.0002462,4 L52.0002462,36 C52.0002462,37.742383 50.8862004,39.2245667 49.331551,39.7731088 L19.0534183,17.0642957 L18.8514268,16.9197066 C16.6722771,15.4321507 13.7258341,15.6945294 11.843688,17.5766755 L11.843688,17.5766755 L0,29.42 L0.000246247657,4 C0.000246247657,1.790861 1.79110725,4.05812251e-16 4.00024625,0 L48.0002462,0 Z M39.0002462,8 C36.7911072,8 35.0002462,9.790861 35.0002462,12 C35.0002462,14.209139 36.7911072,16 39.0002462,16 C41.2093852,16 43.0002462,14.209139 43.0002462,12 C43.0002462,9.790861 41.2093852,8 39.0002462,8 Z" id="形状结合" transform="translate(26.000123, 20.000000) scale(-1, 1) translate(-26.000123, -20.000000) "></path>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
|
|
||||||
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.8 KiB |
|
|
@ -1 +1,12 @@
|
||||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1755247060274" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2413" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M929.181538 212.086154H768L729.6 103.975385A38.144 38.144 0 0 0 693.799385 78.769231H330.200615c-16.009846 0-30.345846 10.121846-35.682461 25.225846L256 212.086154H94.818462C42.436923 212.086154 0 254.680615 0 307.278769v542.72C0 902.636308 42.436923 945.230769 94.818462 945.230769h834.363076C981.563077 945.230769 1024 902.616615 1024 850.018462v-542.72c0-52.617846-42.436923-95.232-94.818462-95.232zM512 754.806154c-104.763077 0-189.636923-85.228308-189.636923-190.424616 0-105.216 84.873846-190.444308 189.636923-190.444307 104.763077 0 189.636923 85.228308 189.636923 190.424615 0 105.216-84.873846 190.424615-189.636923 190.424616z m-113.782154-190.424616c0 30.286769 11.992615 59.352615 33.319385 80.777847a113.526154 113.526154 0 0 0 80.462769 33.476923 113.526154 113.526154 0 0 0 80.443077-33.476923 114.510769 114.510769 0 0 0 33.339077-80.797539 114.510769 114.510769 0 0 0-33.319385-80.777846 113.526154 113.526154 0 0 0-80.462769-33.476923 113.526154 113.526154 0 0 0-80.443077 33.476923 114.510769 114.510769 0 0 0-33.339077 80.777846z" p-id="2414"></path></svg>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="128px" height="128px" viewBox="0 0 128 128" version="1.1">
|
||||||
|
<title>编组 3</title>
|
||||||
|
<g id="当前版" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||||
|
<g id="更多" transform="translate(-47.000000, -1147.000000)">
|
||||||
|
<g id="编组-3" transform="translate(47.000000, 1147.000000)">
|
||||||
|
<rect id="矩形备份-43" fill="#FFFFFF" x="0" y="0" width="128" height="128" rx="20"></rect>
|
||||||
|
<path d="M72.145898,43 C73.2822142,43 74.3210036,43.6420071 74.8291796,44.6583592 L75.8944272,46.7888544 C76.5719952,48.1439905 77.9570477,49 79.472136,49 L87,49 C88.6568542,49 90,50.3431458 90,52 L90,82 C90,83.6568542 88.6568542,85 87,85 L41,85 C39.3431458,85 38,83.6568542 38,82 L38,52 C38,50.3431458 39.3431458,49 41,49 L48.5273733,49 C50.042196,49 51.4270534,48.1442873 52.1047524,46.7895135 L53.1708204,44.6583592 C53.6789964,43.6420071 54.7177858,43 55.854102,43 L72.145898,43 Z M64,54 C57.372583,54 52,59.372583 52,66 C52,72.627417 57.372583,78 64,78 C70.627417,78 76,72.627417 76,66 C76,59.372583 70.627417,54 64,54 Z M64,58 C68.418278,58 72,61.581722 72,66 C72,70.418278 68.418278,74 64,74 C59.581722,74 56,70.418278 56,66 C56,61.581722 59.581722,58 64,58 Z" id="形状结合" fill="#5C6168"></path>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
|
|
||||||
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
|
@ -72,8 +72,7 @@ class MorePanelItem {
|
||||||
final Widget icon;
|
final Widget icon;
|
||||||
final Function(BuildContext context)? onTap;
|
final Function(BuildContext context)? onTap;
|
||||||
|
|
||||||
MorePanelItem(
|
MorePanelItem({this.onTap, required this.icon, required this.id, required this.title});
|
||||||
{this.onTap, required this.icon, required this.id, required this.title});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class MorePanel extends StatefulWidget {
|
class MorePanel extends StatefulWidget {
|
||||||
|
|
@ -85,11 +84,7 @@ class MorePanel extends StatefulWidget {
|
||||||
|
|
||||||
final MorePanelConfig? morePanelConfig;
|
final MorePanelConfig? morePanelConfig;
|
||||||
|
|
||||||
const MorePanel(
|
const MorePanel({required this.conversationID, required this.conversationType, Key? key, this.morePanelConfig})
|
||||||
{required this.conversationID,
|
|
||||||
required this.conversationType,
|
|
||||||
Key? key,
|
|
||||||
this.morePanelConfig})
|
|
||||||
: super(key: key);
|
: super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
@ -98,8 +93,7 @@ class MorePanel extends StatefulWidget {
|
||||||
|
|
||||||
class _MorePanelState extends TIMUIKitState<MorePanel> {
|
class _MorePanelState extends TIMUIKitState<MorePanel> {
|
||||||
final ImagePicker _picker = ImagePicker();
|
final ImagePicker _picker = ImagePicker();
|
||||||
final TUISelfInfoViewModel _selfInfoViewModel =
|
final TUISelfInfoViewModel _selfInfoViewModel = serviceLocator<TUISelfInfoViewModel>();
|
||||||
serviceLocator<TUISelfInfoViewModel>();
|
|
||||||
Uint8List? fileContent;
|
Uint8List? fileContent;
|
||||||
String? fileName;
|
String? fileName;
|
||||||
File? tempFile;
|
File? tempFile;
|
||||||
|
|
@ -120,8 +114,7 @@ class _MorePanelState extends TIMUIKitState<MorePanel> {
|
||||||
isInstallCallkit = value;
|
isInstallCallkit = value;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
_betterPlayerController =
|
_betterPlayerController = BetterPlayerController(const BetterPlayerConfiguration());
|
||||||
BetterPlayerController(const BetterPlayerConfiguration());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -144,11 +137,9 @@ class _MorePanelState extends TIMUIKitState<MorePanel> {
|
||||||
height: 64,
|
height: 64,
|
||||||
width: 64,
|
width: 64,
|
||||||
margin: const EdgeInsets.only(bottom: 4),
|
margin: const EdgeInsets.only(bottom: 4),
|
||||||
decoration: const BoxDecoration(
|
decoration: const BoxDecoration(color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(5))),
|
||||||
color: Colors.white,
|
|
||||||
borderRadius: BorderRadius.all(Radius.circular(5))),
|
|
||||||
child: SvgPicture.asset(
|
child: SvgPicture.asset(
|
||||||
"images/svg/send_image.svg",
|
"images/photo.svg",
|
||||||
package: 'tencent_cloud_chat_uikit',
|
package: 'tencent_cloud_chat_uikit',
|
||||||
height: 64,
|
height: 64,
|
||||||
width: 64,
|
width: 64,
|
||||||
|
|
@ -165,9 +156,7 @@ class _MorePanelState extends TIMUIKitState<MorePanel> {
|
||||||
height: 64,
|
height: 64,
|
||||||
width: 64,
|
width: 64,
|
||||||
margin: const EdgeInsets.only(bottom: 4),
|
margin: const EdgeInsets.only(bottom: 4),
|
||||||
decoration: const BoxDecoration(
|
decoration: const BoxDecoration(color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(5))),
|
||||||
color: Colors.white,
|
|
||||||
borderRadius: BorderRadius.all(Radius.circular(5))),
|
|
||||||
child: SvgPicture.asset(
|
child: SvgPicture.asset(
|
||||||
"images/screen.svg",
|
"images/screen.svg",
|
||||||
package: 'tencent_cloud_chat_uikit',
|
package: 'tencent_cloud_chat_uikit',
|
||||||
|
|
@ -186,9 +175,7 @@ class _MorePanelState extends TIMUIKitState<MorePanel> {
|
||||||
height: 64,
|
height: 64,
|
||||||
width: 64,
|
width: 64,
|
||||||
margin: const EdgeInsets.only(bottom: 4),
|
margin: const EdgeInsets.only(bottom: 4),
|
||||||
decoration: const BoxDecoration(
|
decoration: const BoxDecoration(color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(5))),
|
||||||
color: Colors.white,
|
|
||||||
borderRadius: BorderRadius.all(Radius.circular(5))),
|
|
||||||
child: Image.asset(
|
child: Image.asset(
|
||||||
"images/take_video.png",
|
"images/take_video.png",
|
||||||
package: 'tencent_cloud_chat_uikit',
|
package: 'tencent_cloud_chat_uikit',
|
||||||
|
|
@ -212,11 +199,9 @@ class _MorePanelState extends TIMUIKitState<MorePanel> {
|
||||||
height: 64,
|
height: 64,
|
||||||
width: 64,
|
width: 64,
|
||||||
margin: const EdgeInsets.only(bottom: 4),
|
margin: const EdgeInsets.only(bottom: 4),
|
||||||
decoration: const BoxDecoration(
|
decoration: const BoxDecoration(color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(5))),
|
||||||
color: Colors.white,
|
|
||||||
borderRadius: BorderRadius.all(Radius.circular(5))),
|
|
||||||
child: SvgPicture.asset(
|
child: SvgPicture.asset(
|
||||||
"images/svg/send_image.svg",
|
"images/photo.svg",
|
||||||
package: 'tencent_cloud_chat_uikit',
|
package: 'tencent_cloud_chat_uikit',
|
||||||
height: 64,
|
height: 64,
|
||||||
width: 64,
|
width: 64,
|
||||||
|
|
@ -238,11 +223,8 @@ class _MorePanelState extends TIMUIKitState<MorePanel> {
|
||||||
height: 64,
|
height: 64,
|
||||||
width: 64,
|
width: 64,
|
||||||
margin: const EdgeInsets.only(bottom: 4),
|
margin: const EdgeInsets.only(bottom: 4),
|
||||||
decoration: const BoxDecoration(
|
decoration: const BoxDecoration(color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(5))),
|
||||||
color: Colors.white,
|
child: Icon(Icons.video_file, color: hexToColor("5c6168"), size: 26),
|
||||||
borderRadius: BorderRadius.all(Radius.circular(5))),
|
|
||||||
child:
|
|
||||||
Icon(Icons.video_file, color: hexToColor("5c6168"), size: 26),
|
|
||||||
)),
|
)),
|
||||||
MorePanelItem(
|
MorePanelItem(
|
||||||
id: "file",
|
id: "file",
|
||||||
|
|
@ -259,11 +241,9 @@ class _MorePanelState extends TIMUIKitState<MorePanel> {
|
||||||
height: 64,
|
height: 64,
|
||||||
width: 64,
|
width: 64,
|
||||||
margin: const EdgeInsets.only(bottom: 4),
|
margin: const EdgeInsets.only(bottom: 4),
|
||||||
decoration: const BoxDecoration(
|
decoration: const BoxDecoration(color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(5))),
|
||||||
color: Colors.white,
|
|
||||||
borderRadius: BorderRadius.all(Radius.circular(5))),
|
|
||||||
child: SvgPicture.asset(
|
child: SvgPicture.asset(
|
||||||
"images/svg/send_file.svg",
|
"images/file.svg",
|
||||||
package: 'tencent_cloud_chat_uikit',
|
package: 'tencent_cloud_chat_uikit',
|
||||||
height: 64,
|
height: 64,
|
||||||
width: 64,
|
width: 64,
|
||||||
|
|
@ -285,9 +265,7 @@ class _MorePanelState extends TIMUIKitState<MorePanel> {
|
||||||
height: 64,
|
height: 64,
|
||||||
width: 64,
|
width: 64,
|
||||||
margin: const EdgeInsets.only(bottom: 4),
|
margin: const EdgeInsets.only(bottom: 4),
|
||||||
decoration: const BoxDecoration(
|
decoration: const BoxDecoration(color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(5))),
|
||||||
color: Colors.white,
|
|
||||||
borderRadius: BorderRadius.all(Radius.circular(5))),
|
|
||||||
child: SvgPicture.asset(
|
child: SvgPicture.asset(
|
||||||
"images/video-call.svg",
|
"images/video-call.svg",
|
||||||
package: 'tencent_cloud_chat_uikit',
|
package: 'tencent_cloud_chat_uikit',
|
||||||
|
|
@ -311,9 +289,7 @@ class _MorePanelState extends TIMUIKitState<MorePanel> {
|
||||||
height: 64,
|
height: 64,
|
||||||
width: 64,
|
width: 64,
|
||||||
margin: const EdgeInsets.only(bottom: 4),
|
margin: const EdgeInsets.only(bottom: 4),
|
||||||
decoration: const BoxDecoration(
|
decoration: const BoxDecoration(color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(5))),
|
||||||
color: Colors.white,
|
|
||||||
borderRadius: BorderRadius.all(Radius.circular(5))),
|
|
||||||
child: SvgPicture.asset(
|
child: SvgPicture.asset(
|
||||||
"images/voice-call.svg",
|
"images/voice-call.svg",
|
||||||
package: 'tencent_cloud_chat_uikit',
|
package: 'tencent_cloud_chat_uikit',
|
||||||
|
|
@ -352,11 +328,9 @@ class _MorePanelState extends TIMUIKitState<MorePanel> {
|
||||||
}).toList();
|
}).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
_sendVideoMessage(String originFilePath, int duration, int size,
|
_sendVideoMessage(String originFilePath, int duration, int size, TUIChatSeparateViewModel model) async {
|
||||||
TUIChatSeparateViewModel model) async {
|
|
||||||
if (size >= MorePanelConfig.VIDEO_MAX_SIZE) {
|
if (size >= MorePanelConfig.VIDEO_MAX_SIZE) {
|
||||||
onTIMCallback(TIMCallback(
|
onTIMCallback(TIMCallback(type: TIMCallbackType.INFO, infoRecommendText: TIM_t("文件大小超出了限制")));
|
||||||
type: TIMCallbackType.INFO, infoRecommendText: TIM_t("文件大小超出了限制")));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -365,9 +339,7 @@ class _MorePanelState extends TIMUIKitState<MorePanel> {
|
||||||
final convID = widget.conversationID;
|
final convID = widget.conversationID;
|
||||||
final convType = widget.conversationType;
|
final convType = widget.conversationType;
|
||||||
|
|
||||||
String tempPath = (await getTemporaryDirectory()).path +
|
String tempPath = (await getTemporaryDirectory()).path + p.basename(originFilePath) + ".jpeg";
|
||||||
p.basename(originFilePath) +
|
|
||||||
".jpeg";
|
|
||||||
|
|
||||||
await plugin.getVideoThumbnail(
|
await plugin.getVideoThumbnail(
|
||||||
srcFile: originFilePath,
|
srcFile: originFilePath,
|
||||||
|
|
@ -379,11 +351,7 @@ class _MorePanelState extends TIMUIKitState<MorePanel> {
|
||||||
);
|
);
|
||||||
MessageUtils.handleMessageError(
|
MessageUtils.handleMessageError(
|
||||||
model.sendVideoMessage(
|
model.sendVideoMessage(
|
||||||
videoPath: originFilePath,
|
videoPath: originFilePath, duration: duration, snapshotPath: tempPath, convID: convID, convType: convType),
|
||||||
duration: duration,
|
|
||||||
snapshotPath: tempPath,
|
|
||||||
convID: convID,
|
|
||||||
convType: convType),
|
|
||||||
context);
|
context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -443,47 +411,34 @@ class _MorePanelState extends TIMUIKitState<MorePanel> {
|
||||||
if (filePath != null) {
|
if (filePath != null) {
|
||||||
if (type == AssetType.image) {
|
if (type == AssetType.image) {
|
||||||
if (size >= MorePanelConfig.IMAGE_MAX_SIZE) {
|
if (size >= MorePanelConfig.IMAGE_MAX_SIZE) {
|
||||||
onTIMCallback(TIMCallback(
|
onTIMCallback(TIMCallback(type: TIMCallbackType.INFO, infoRecommendText: TIM_t("文件大小超出了限制")));
|
||||||
type: TIMCallbackType.INFO,
|
|
||||||
infoRecommendText: TIM_t("文件大小超出了限制")));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageUtils.handleMessageError(
|
MessageUtils.handleMessageError(
|
||||||
model.sendImageMessage(
|
model.sendImageMessage(imagePath: filePath, convID: convID, convType: convType), context);
|
||||||
imagePath: filePath,
|
|
||||||
convID: convID,
|
|
||||||
convType: convType),
|
|
||||||
context);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == AssetType.video) {
|
if (type == AssetType.video) {
|
||||||
_sendVideoMessage(originFile!.path,
|
_sendVideoMessage(originFile!.path, asset.videoDuration.inSeconds, size, model);
|
||||||
asset.videoDuration.inSeconds, size, model);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
FilePickerResult? result =
|
FilePickerResult? result = await FilePicker.platform.pickFiles(type: FileType.media);
|
||||||
await FilePicker.platform.pickFiles(type: FileType.media);
|
|
||||||
if (result != null && result.files.isNotEmpty) {
|
if (result != null && result.files.isNotEmpty) {
|
||||||
File file = File(result.files.single.path!);
|
File file = File(result.files.single.path!);
|
||||||
final String savePath = file.path;
|
final String savePath = file.path;
|
||||||
final String type = TencentUtils.getFileType(
|
final String type =
|
||||||
savePath.split(".")[savePath.split(".").length - 1])
|
TencentUtils.getFileType(savePath.split(".")[savePath.split(".").length - 1]).split("/")[0];
|
||||||
.split("/")[0];
|
|
||||||
|
|
||||||
if (type == "image") {
|
if (type == "image") {
|
||||||
MessageUtils.handleMessageError(
|
MessageUtils.handleMessageError(
|
||||||
model.sendImageMessage(
|
model.sendImageMessage(imagePath: savePath, convID: convID, convType: convType), context);
|
||||||
imagePath: savePath, convID: convID, convType: convType),
|
|
||||||
context);
|
|
||||||
} else if (type == "video") {
|
} else if (type == "video") {
|
||||||
MessageUtils.handleMessageError(
|
MessageUtils.handleMessageError(
|
||||||
model.sendVideoMessage(
|
model.sendVideoMessage(videoPath: savePath, convID: convID, convType: convType), context);
|
||||||
videoPath: savePath, convID: convID, convType: convType),
|
|
||||||
context);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw TypeError();
|
throw TypeError();
|
||||||
|
|
@ -494,8 +449,7 @@ class _MorePanelState extends TIMUIKitState<MorePanel> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_sendImageFromCamera(TUIChatSeparateViewModel model, TUITheme theme,
|
_sendImageFromCamera(TUIChatSeparateViewModel model, TUITheme theme, {required isVideo}) async {
|
||||||
{required isVideo}) async {
|
|
||||||
try {
|
try {
|
||||||
if (!await Permissions.checkPermission(
|
if (!await Permissions.checkPermission(
|
||||||
context,
|
context,
|
||||||
|
|
@ -522,25 +476,18 @@ class _MorePanelState extends TIMUIKitState<MorePanel> {
|
||||||
final size = await originFile!.length();
|
final size = await originFile!.length();
|
||||||
if (!isVideo) {
|
if (!isVideo) {
|
||||||
if (size >= MorePanelConfig.IMAGE_MAX_SIZE) {
|
if (size >= MorePanelConfig.IMAGE_MAX_SIZE) {
|
||||||
onTIMCallback(TIMCallback(
|
onTIMCallback(TIMCallback(type: TIMCallbackType.INFO, infoRecommendText: TIM_t("文件大小超出了限制")));
|
||||||
type: TIMCallbackType.INFO,
|
|
||||||
infoRecommendText: TIM_t("文件大小超出了限制")));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageUtils.handleMessageError(
|
MessageUtils.handleMessageError(
|
||||||
model.sendImageMessage(
|
model.sendImageMessage(imagePath: originFile.path, convID: convID, convType: convType), context);
|
||||||
imagePath: originFile.path, convID: convID, convType: convType),
|
|
||||||
context);
|
|
||||||
} else {
|
} else {
|
||||||
// 监听视频准备完成事件
|
// 监听视频准备完成事件
|
||||||
_betterPlayerController.addEventsListener((event) {
|
_betterPlayerController.addEventsListener((event) {
|
||||||
if (event.betterPlayerEventType ==
|
if (event.betterPlayerEventType == BetterPlayerEventType.initialized) {
|
||||||
BetterPlayerEventType.initialized) {
|
|
||||||
// 获取视频时长(单位:秒)
|
// 获取视频时长(单位:秒)
|
||||||
int durationInSeconds = _betterPlayerController
|
int durationInSeconds = _betterPlayerController.videoPlayerController?.value.duration?.inSeconds ?? 0;
|
||||||
.videoPlayerController?.value.duration?.inSeconds ??
|
|
||||||
0;
|
|
||||||
_sendVideoMessage(originFile!.path, durationInSeconds, size, model);
|
_sendVideoMessage(originFile!.path, durationInSeconds, size, model);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -567,17 +514,12 @@ class _MorePanelState extends TIMUIKitState<MorePanel> {
|
||||||
fileContent = imageContent;
|
fileContent = imageContent;
|
||||||
|
|
||||||
html.Node? inputElem;
|
html.Node? inputElem;
|
||||||
inputElem = html.document
|
inputElem = html.document.getElementById("__image_picker_web-file-input")?.querySelector("input");
|
||||||
.getElementById("__image_picker_web-file-input")
|
|
||||||
?.querySelector("input");
|
|
||||||
final convID = widget.conversationID;
|
final convID = widget.conversationID;
|
||||||
final convType = widget.conversationType;
|
final convType = widget.conversationType;
|
||||||
MessageUtils.handleMessageError(
|
MessageUtils.handleMessageError(
|
||||||
model.sendImageMessage(
|
model.sendImageMessage(
|
||||||
inputElement: inputElem,
|
inputElement: inputElem, imagePath: tempFile?.path, convID: convID, convType: convType),
|
||||||
imagePath: tempFile?.path,
|
|
||||||
convID: convID,
|
|
||||||
convType: convType),
|
|
||||||
context);
|
context);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
outputLogger.i("_sendFileErr: ${e.toString()}");
|
outputLogger.i("_sendFileErr: ${e.toString()}");
|
||||||
|
|
@ -593,25 +535,18 @@ class _MorePanelState extends TIMUIKitState<MorePanel> {
|
||||||
fileContent = videoContent;
|
fileContent = videoContent;
|
||||||
|
|
||||||
if (fileName!.split(".")[fileName!.split(".").length - 1] != "mp4") {
|
if (fileName!.split(".")[fileName!.split(".").length - 1] != "mp4") {
|
||||||
onTIMCallback(TIMCallback(
|
onTIMCallback(
|
||||||
type: TIMCallbackType.INFO,
|
TIMCallback(type: TIMCallbackType.INFO, infoRecommendText: TIM_t("视频消息仅限 mp4 格式"), infoCode: 6660412));
|
||||||
infoRecommendText: TIM_t("视频消息仅限 mp4 格式"),
|
|
||||||
infoCode: 6660412));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
html.Node? inputElem;
|
html.Node? inputElem;
|
||||||
inputElem = html.document
|
inputElem = html.document.getElementById("__image_picker_web-file-input")?.querySelector("input");
|
||||||
.getElementById("__image_picker_web-file-input")
|
|
||||||
?.querySelector("input");
|
|
||||||
final convID = widget.conversationID;
|
final convID = widget.conversationID;
|
||||||
final convType = widget.conversationType;
|
final convType = widget.conversationType;
|
||||||
MessageUtils.handleMessageError(
|
MessageUtils.handleMessageError(
|
||||||
model.sendVideoMessage(
|
model.sendVideoMessage(
|
||||||
inputElement: inputElem,
|
inputElement: inputElem, videoPath: tempFile?.path, convID: convID, convType: convType),
|
||||||
videoPath: tempFile?.path,
|
|
||||||
convID: convID,
|
|
||||||
convType: convType),
|
|
||||||
context);
|
context);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
outputLogger.i("_sendFileErr: ${e.toString()}");
|
outputLogger.i("_sendFileErr: ${e.toString()}");
|
||||||
|
|
@ -629,43 +564,29 @@ class _MorePanelState extends TIMUIKitState<MorePanel> {
|
||||||
if (result != null && result.files.isNotEmpty) {
|
if (result != null && result.files.isNotEmpty) {
|
||||||
if (PlatformUtils().isWeb) {
|
if (PlatformUtils().isWeb) {
|
||||||
html.Node? inputElem;
|
html.Node? inputElem;
|
||||||
inputElem = html.document
|
inputElem = html.document.getElementById("__file_picker_web-file-input")?.querySelector("input");
|
||||||
.getElementById("__file_picker_web-file-input")
|
|
||||||
?.querySelector("input");
|
|
||||||
fileName = result.files.single.name;
|
fileName = result.files.single.name;
|
||||||
|
|
||||||
MessageUtils.handleMessageError(
|
MessageUtils.handleMessageError(
|
||||||
model.sendFileMessage(
|
model.sendFileMessage(inputElement: inputElem, fileName: fileName, convID: convID, convType: convType),
|
||||||
inputElement: inputElem,
|
|
||||||
fileName: fileName,
|
|
||||||
convID: convID,
|
|
||||||
convType: convType),
|
|
||||||
context);
|
context);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String? option2 = result.files.single.path ?? "";
|
String? option2 = result.files.single.path ?? "";
|
||||||
outputLogger
|
outputLogger.i(TIM_t_para("选择成功{{option2}}", "选择成功$option2")(option2: option2));
|
||||||
.i(TIM_t_para("选择成功{{option2}}", "选择成功$option2")(option2: option2));
|
|
||||||
|
|
||||||
File file = File(result.files.single.path!);
|
File file = File(result.files.single.path!);
|
||||||
final int size = file.lengthSync();
|
final int size = file.lengthSync();
|
||||||
if (size >= MorePanelConfig.FILE_MAX_SIZE) {
|
if (size >= MorePanelConfig.FILE_MAX_SIZE) {
|
||||||
onTIMCallback(TIMCallback(
|
onTIMCallback(TIMCallback(type: TIMCallbackType.INFO, infoRecommendText: TIM_t("文件大小超出了限制")));
|
||||||
type: TIMCallbackType.INFO,
|
|
||||||
infoRecommendText: TIM_t("文件大小超出了限制")));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final String savePath = file.path;
|
final String savePath = file.path;
|
||||||
|
|
||||||
MessageUtils.handleMessageError(
|
MessageUtils.handleMessageError(
|
||||||
model.sendFileMessage(
|
model.sendFileMessage(filePath: savePath, size: size, convID: convID, convType: convType), context);
|
||||||
filePath: savePath,
|
|
||||||
size: size,
|
|
||||||
convID: convID,
|
|
||||||
convType: convType),
|
|
||||||
context);
|
|
||||||
} else {
|
} else {
|
||||||
throw TypeError();
|
throw TypeError();
|
||||||
}
|
}
|
||||||
|
|
@ -715,16 +636,13 @@ class _MorePanelState extends TIMUIKitState<MorePanel> {
|
||||||
bool hasCameraPermission = false;
|
bool hasCameraPermission = false;
|
||||||
bool hasMicrophonePermission = false;
|
bool hasMicrophonePermission = false;
|
||||||
if (type == TYPE_VIDEO) {
|
if (type == TYPE_VIDEO) {
|
||||||
hasCameraPermission =
|
hasCameraPermission = await Permissions.checkPermission(context, Permission.camera.value);
|
||||||
await Permissions.checkPermission(context, Permission.camera.value);
|
hasMicrophonePermission = await Permissions.checkPermission(context, Permission.microphone.value);
|
||||||
hasMicrophonePermission = await Permissions.checkPermission(
|
|
||||||
context, Permission.microphone.value);
|
|
||||||
if (!hasCameraPermission || !hasMicrophonePermission) {
|
if (!hasCameraPermission || !hasMicrophonePermission) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
hasMicrophonePermission = await Permissions.checkPermission(
|
hasMicrophonePermission = await Permissions.checkPermission(context, Permission.microphone.value);
|
||||||
context, Permission.microphone.value);
|
|
||||||
if (!hasMicrophonePermission) {
|
if (!hasMicrophonePermission) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -746,9 +664,7 @@ class _MorePanelState extends TIMUIKitState<MorePanel> {
|
||||||
_tUICore.callService(TUICALLKIT_SERVICE_NAME, METHOD_NAME_CALL, {
|
_tUICore.callService(TUICALLKIT_SERVICE_NAME, METHOD_NAME_CALL, {
|
||||||
PARAM_NAME_TYPE: type,
|
PARAM_NAME_TYPE: type,
|
||||||
PARAM_NAME_USERIDS: inviteMember,
|
PARAM_NAME_USERIDS: inviteMember,
|
||||||
PARAM_NAME_GROUPID: widget.conversationType == ConvType.group
|
PARAM_NAME_GROUPID: widget.conversationType == ConvType.group ? widget.conversationID : ""
|
||||||
? widget.conversationID
|
|
||||||
: ""
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -769,8 +685,7 @@ class _MorePanelState extends TIMUIKitState<MorePanel> {
|
||||||
@override
|
@override
|
||||||
Widget tuiBuild(BuildContext context, TUIKitBuildValue value) {
|
Widget tuiBuild(BuildContext context, TUIKitBuildValue value) {
|
||||||
final TUITheme theme = value.theme;
|
final TUITheme theme = value.theme;
|
||||||
final TUIChatSeparateViewModel model =
|
final TUIChatSeparateViewModel model = Provider.of<TUIChatSeparateViewModel>(context);
|
||||||
Provider.of<TUIChatSeparateViewModel>(context);
|
|
||||||
final screenWidth = MediaQuery.of(context).size.width;
|
final screenWidth = MediaQuery.of(context).size.width;
|
||||||
return Container(
|
return Container(
|
||||||
height: 248,
|
height: 248,
|
||||||
|
|
@ -807,15 +722,12 @@ class _MorePanelState extends TIMUIKitState<MorePanel> {
|
||||||
height: 64,
|
height: 64,
|
||||||
width: 64,
|
width: 64,
|
||||||
margin: const EdgeInsets.only(bottom: 4),
|
margin: const EdgeInsets.only(bottom: 4),
|
||||||
decoration: const BoxDecoration(
|
decoration: const BoxDecoration(borderRadius: BorderRadius.all(Radius.circular(5))),
|
||||||
borderRadius:
|
|
||||||
BorderRadius.all(Radius.circular(5))),
|
|
||||||
child: item.icon,
|
child: item.icon,
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
item.title,
|
item.title,
|
||||||
style: TextStyle(
|
style: TextStyle(fontSize: 12, color: theme.darkTextColor),
|
||||||
fontSize: 12, color: theme.darkTextColor),
|
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue