diff --git a/lib/modules/meeting/views/share_bottom_sheet.dart b/lib/modules/meeting/views/share_bottom_sheet.dart index 42b377255..318d40df7 100644 --- a/lib/modules/meeting/views/share_bottom_sheet.dart +++ b/lib/modules/meeting/views/share_bottom_sheet.dart @@ -72,16 +72,42 @@ class _ShareBottomSheetState extends State { child: Column( children: [ _box([ - _shareItem(Icons.link, '分享链接', isBorder: false, onTap: () { - final GetStorage storage = GetStorage(); - String token = storage.read("logintoken") ?? ''; - String userId = ''; - Map? userInfo = storage.read("user_info"); - if (userInfo != null) { - userId = userInfo['user']['uid']; - } - String id = '${userId}_${_controller.meetingData.value.id}'; - }), + _shareItem( + Icons.link, + '分享链接', + isBorder: false, + onTap: () async { + Get.back(); + final GetStorage storage = GetStorage(); + String token = storage.read("logintoken") ?? ''; + String userId = ''; + Map? userInfo = storage.read("user_info"); + if (userInfo != null) { + userId = userInfo['user']['uid']; + } + + String id = + '${userId}_${_controller.meetingData.value.id}'; + + final thumbnail = await getAssetThumbnailFile( + 'assets/images/headphone_dark.png', + 'share_thumb.png', + ); + + final result = await SharePlus.instance.share(ShareParams( + title: _controller.meetingData.value.title, + subject: + 'DeepSound WEB,由DeepSound.Ai提供支持-实时记录会议纪要,多语言翻译。', + uri: Uri.parse( + 'http://web.ideapsound.com/share/$id/$token', + ), + previewThumbnail: thumbnail, + )); + if (result.status == ShareResultStatus.success) { + EasyLoading.showToast('分享完成!'); + } + }, + ), ]), _box([ _shareItem(Icons.copy, '复制转写', onTap: () { @@ -223,4 +249,12 @@ class _ShareBottomSheetState extends State { } return text; } + + Future getAssetThumbnailFile(String assetPath, String fileName) async { + final byteData = await rootBundle.load(assetPath); + final tempDir = await getTemporaryDirectory(); + final file = File('${tempDir.path}/$fileName'); + await file.writeAsBytes(byteData.buffer.asUint8List()); + return XFile(file.path); + } }