Browse Source

添加分享链接

weicu
tanlongsheng 1 year ago
parent
commit
9ee7fde0b0
  1. 40
      lib/modules/meeting/views/share_bottom_sheet.dart

40
lib/modules/meeting/views/share_bottom_sheet.dart

@ -72,7 +72,12 @@ class _ShareBottomSheetState extends State<ShareBottomSheet> {
child: Column(
children: [
_box([
_shareItem(Icons.link, '分享链接', isBorder: false, onTap: () {
_shareItem(
Icons.link,
'分享链接',
isBorder: false,
onTap: () async {
Get.back();
final GetStorage storage = GetStorage();
String token = storage.read("logintoken") ?? '';
String userId = '';
@ -80,8 +85,29 @@ class _ShareBottomSheetState extends State<ShareBottomSheet> {
if (userInfo != null) {
userId = userInfo['user']['uid'];
}
String id = '${userId}_${_controller.meetingData.value.id}';
}),
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<ShareBottomSheet> {
}
return text;
}
Future<XFile> 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);
}
}

Loading…
Cancel
Save