Browse Source

feat(meeting): 在分享底部弹窗中添加保存思维导图功能

为思维导图功能添加本地保存选项,新增对应的国际化文本键值。
在分享底部弹窗中增加“保存思维导图”按钮,与现有的“分享思维导图”功能并列。
移除未使用的版本更新服务导入以保持代码整洁。
newdev_shunjiawei
lxm 7 months ago
parent
commit
2af06a09d8
  1. 1
      lib/core/translations/language/en_us.dart
  2. 1
      lib/core/translations/language/zh_cn.dart
  3. 1
      lib/core/translations/language/zh_hk.dart
  4. 1
      lib/core/translations/language/zh_tw.dart
  5. 435
      lib/modules/meeting/views/bottomSheet/share_bottom_sheet.dart

1
lib/core/translations/language/en_us.dart

@ -657,6 +657,7 @@ const Map<String, String> enUS = {
'Detected that you have permanently denied storage permission. To continue using this feature, please go to app settings to manually enable storage permission.', 'Detected that you have permanently denied storage permission. To continue using this feature, please go to app settings to manually enable storage permission.',
// Meeting模块 - 思维导图相关 // Meeting模块 - 思维导图相关
'saveMindMap': 'Save Mind Map',
'shareMindMap': 'Share Mind Map', 'shareMindMap': 'Share Mind Map',
'shareSuccess': 'Share Success', 'shareSuccess': 'Share Success',

1
lib/core/translations/language/zh_cn.dart

@ -608,6 +608,7 @@ const Map<String, String> zhCN = {
'检测到您已永久拒绝存储权限。如需继续使用此功能,请前往应用设置中手动开启存储权限。', '检测到您已永久拒绝存储权限。如需继续使用此功能,请前往应用设置中手动开启存储权限。',
// Meeting模块 - 思维导图相关 // Meeting模块 - 思维导图相关
'saveMindMap': '保存思维导图',
'shareMindMap': '分享思维导图', 'shareMindMap': '分享思维导图',
'shareSuccess': '分享成功', 'shareSuccess': '分享成功',

1
lib/core/translations/language/zh_hk.dart

@ -609,6 +609,7 @@ const Map<String, String> zhHK = {
'檢測到您已永久拒絕儲存權限。如需繼續使用此功能,請前往應用設定中手動開啟儲存權限。', '檢測到您已永久拒絕儲存權限。如需繼續使用此功能,請前往應用設定中手動開啟儲存權限。',
// Meeting模块 - 思维导图相关 // Meeting模块 - 思维导图相关
'saveMindMap': '儲存思維導圖',
'shareMindMap': '分享思維導圖', 'shareMindMap': '分享思維導圖',
'shareSuccess': '分享成功', 'shareSuccess': '分享成功',

1
lib/core/translations/language/zh_tw.dart

@ -609,6 +609,7 @@ const Map<String, String> zhTW = {
'檢測到您已永久拒絕儲存權限。如需繼續使用此功能,請前往應用設定中手動開啟儲存權限。', '檢測到您已永久拒絕儲存權限。如需繼續使用此功能,請前往應用設定中手動開啟儲存權限。',
// Meeting模块 - 思维导图相关 // Meeting模块 - 思维导图相关
'saveMindMap': '儲存思維導圖',
'shareMindMap': '分享思維導圖', 'shareMindMap': '分享思維導圖',
'shareSuccess': '分享成功', 'shareSuccess': '分享成功',

435
lib/modules/meeting/views/bottomSheet/share_bottom_sheet.dart

@ -13,7 +13,6 @@ import 'package:share_plus/share_plus.dart';
import 'package:webview_flutter/webview_flutter.dart'; import 'package:webview_flutter/webview_flutter.dart';
import '../../../../data/services/version_update_service.dart';
import '../../../../data/services/network/dio_manager.dart'; import '../../../../data/services/network/dio_manager.dart';
import '../../controllers/meeting_details_controller.dart'; import '../../controllers/meeting_details_controller.dart';
import '../../controllers/mind_map_controller.dart'; import '../../controllers/mind_map_controller.dart';
@ -38,237 +37,243 @@ class _ShareBottomSheetState extends State<ShareBottomSheet> {
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
Container( Container(
padding: EdgeInsets.symmetric(vertical: 10.w), padding: EdgeInsets.symmetric(vertical: 10.w),
child: Row( child: Row(
children: [ children: [
Icon( Icon(
Icons.audio_file_outlined, Icons.audio_file_outlined,
color: Colors.grey, color: Colors.grey,
size: 32.w, size: 32.w,
),
5.horizontalSpace,
Expanded(
child: Text(
_controller.meetingData.value.title,
style: TextStyle(
fontSize: 16.sp,
color: Colors.black87,
),
), ),
), 5.horizontalSpace,
GestureDetector( Expanded(
onTap: () => Get.back(), child: Text(
child: Container( _controller.meetingData.value.title,
width: 26.w, style: TextStyle(
height: 26.w, fontSize: 16.sp,
decoration: BoxDecoration( color: Colors.black87,
color: Colors.white, ),
borderRadius: BorderRadius.circular(26.r),
),
child: Icon(
Icons.close,
size: 18.w,
color: Colors.grey[400],
), ),
), ),
) GestureDetector(
], onTap: () => Get.back(),
child: Container(
width: 26.w,
height: 26.w,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(26.r),
),
child: Icon(
Icons.close,
size: 18.w,
color: Colors.grey[400],
),
),
)
],
),
), ),
), Padding(
Padding( padding: EdgeInsets.symmetric(vertical: 10.w),
padding: EdgeInsets.symmetric(vertical: 10.w), child: Column(
child: Column( children: [
children: [ _box([
_box([ _shareItem(
_shareItem( Icons.link,
Icons.link, 'shareLink'.tr, // 对应中文:分享链接
'shareLink'.tr, // 对应中文:分享链接
isBorder: false,
onTap: () async {
Get.back();
final GetStorage storage = GetStorage();
String token = storage.read("logintoken") ?? '';
int id = _controller.meetingData.value.id;
// final thumbnail = await getAssetThumbnailFile(
// 'assets/images/mine-background.png',
// 'share_thumb.png',
// );
// 获取动态服务器地址
final serverUrl = DioManager().baseUrl;
final serverHost = serverUrl
.replaceFirst('https://', '')
.replaceFirst('http://', '');
final result = await SharePlus.instance.share(ShareParams(
title: _controller.meetingData.value.title,
subject:
'Voitrans WEB,由DeepSound.Ai提供支持-实时记录会议纪要,多语言翻译。',
uri: Uri.parse(
'https://share.deepechomeet.com/share/$serverHost/voitrans.net/$id/$token',
),
//previewThumbnail: thumbnail,
));
if (result.status == ShareResultStatus.success) {
EasyLoading.showToast('shareSuccess'.tr); // 对应中文:分享完成
}
},
),
]),
_box([
_shareItem(Icons.copy, 'copyTranscript'.tr, // 对应中文:复制转写
onTap: _controller.meetingDetails.value.tasktype >= 3 &&
_controller.meetingDetails.value.tasktype < 10002
? () {
Get.back();
_copy(_getAllText());
}
: null),
_shareItem(Icons.copy, 'copySummary'.tr, // 对应中文:复制总结
isBorder: false, isBorder: false,
onTap: () async {
Get.back();
final GetStorage storage = GetStorage();
String token = storage.read("logintoken") ?? '';
int id = _controller.meetingData.value.id;
// final thumbnail = await getAssetThumbnailFile(
// 'assets/images/mine-background.png',
// 'share_thumb.png',
// );
// 获取动态服务器地址
final serverUrl = DioManager().baseUrl;
final serverHost = serverUrl
.replaceFirst('https://', '')
.replaceFirst('http://', '');
final result =
await SharePlus.instance.share(ShareParams(
title: _controller.meetingData.value.title,
subject:
'Voitrans WEB,由DeepSound.Ai提供支持-实时记录会议纪要,多语言翻译。',
uri: Uri.parse(
'https://share.deepechomeet.com/share/$serverHost/voitrans.net/$id/$token',
),
//previewThumbnail: thumbnail,
));
if (result.status == ShareResultStatus.success) {
EasyLoading.showToast('shareSuccess'.tr); // 对应中文:分享完成
}
},
),
]),
_box([
_shareItem(Icons.copy, 'copyTranscript'.tr, // 对应中文:复制转写
onTap: _controller.meetingDetails.value.tasktype >= 3 &&
_controller.meetingDetails.value.tasktype <
10002
? () {
Get.back();
_copy(_getAllText());
}
: null),
_shareItem(Icons.copy, 'copySummary'.tr, // 对应中文:复制总结
isBorder: false,
onTap: _controller.meetingDetails.value.tasktype >= 5 &&
_controller.meetingDetails.value.tasktype <
10001
? () {
Get.back();
_copy(_markdownToPlainText(
_controller.meetingDetails.value.summary));
}
: null),
]),
_box([
_shareItem(
Icons.multitrack_audio, 'exportAudio'.tr, // 对应中文:导出音频
onTap: () {
Get.back();
_share(_controller.meetingData.value.filepath,
'shareMeetingAudio'.tr); // 对应中文:分享会议音频
}),
_shareItem(
Icons.message, 'exportTranscript'.tr, // 对应中文:导出转写
onTap: _controller.meetingDetails.value.tasktype >= 3 &&
_controller.meetingDetails.value.tasktype <
10002
? () async {
Get.back();
final tempDir = await getTemporaryDirectory();
final file = File(
'${tempDir.path}/${_controller.meetingData.value.title}_speaker.txt');
String allText = _getAllText();
await file.writeAsString(allText);
_share(file.path,
'exportTranscript'.tr); // 对应中文:分享会议转写
}
: null),
_shareItem(Icons.article, 'exportSummary'.tr, // 对应中文:导出总结
onTap: _controller.meetingDetails.value.tasktype >= 5 &&
_controller.meetingDetails.value.tasktype <
10001
? () async {
Get.back();
Get.bottomSheet(
SecondLevelBottomSheet(
'exportSummary'.tr, // 对应中文:导出总结
'exportAs'.tr, // 对应中文:导出为
(int index) async {
if (index == 0) {
// 导出TXT
final tempDir =
await getTemporaryDirectory();
final file = File(
'${tempDir.path}/${_controller.meetingData.value.title}_summary.txt');
await file.writeAsString(
_markdownToPlainText(_controller
.meetingDetails.value.summary));
_share(file.path,
'exportSummary'.tr); // 对应中文:分享会议总结
} else {
// 导出PDF
_exportMarkdownPdf();
}
},
const [
{
'icon': Icons.text_snippet,
'title': 'TXT',
'isBorder': true,
},
{
'icon': Icons.picture_as_pdf,
'title': 'PDF',
'isBorder': false,
},
],
),
isScrollControlled: true,
backgroundColor: Colors.grey[100],
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(
top: Radius.circular(12.r),
),
),
);
}
: null),
_shareItem(
Icons.save_alt,
'saveMindMap'.tr,
onTap: _controller.meetingDetails.value.tasktype >= 5 && onTap: _controller.meetingDetails.value.tasktype >= 5 &&
_controller.meetingDetails.value.tasktype < 10001 _controller.meetingDetails.value.tasktype < 10001
? () { ? () {
Get.back(); Get.back();
_copy(_markdownToPlainText( final mindMapController =
_controller.meetingDetails.value.summary)); Get.find<MindMapController>();
} mindMapController.imageType = 1;
: null), if (mindMapController.isWebViewReady) {
]), mindMapController.webViewController
_box([ .runJavaScript('captureImage()');
_shareItem( } else {
Icons.multitrack_audio, 'exportAudio'.tr, // 对应中文:导出音频 mindMapController.webViewController
onTap: () { .setNavigationDelegate(
Get.back(); NavigationDelegate(
_share(_controller.meetingData.value.filepath, onPageFinished: (String url) {
'shareMeetingAudio'.tr); // 对应中文:分享会议音频 mindMapController.isWebViewReady = true;
}), mindMapController.webViewController
_shareItem(Icons.message, 'exportTranscript'.tr, // 对应中文:导出转写 .runJavaScript('captureImage()');
onTap: _controller.meetingDetails.value.tasktype >= 3 && },
_controller.meetingDetails.value.tasktype < 10002 ),
? () async { );
Get.back(); }
final tempDir = await getTemporaryDirectory();
final file = File(
'${tempDir.path}/${_controller.meetingData.value.title}_speaker.txt');
String allText = _getAllText();
await file.writeAsString(allText);
_share(file.path,
'exportTranscript'.tr); // 对应中文:分享会议转写
} }
: null), : null,
_shareItem(Icons.article, 'exportSummary'.tr, // 对应中文:导出总结 ),
_shareItem(
Icons.lan,
'shareMindMap'.tr, // 对应中文:分享思维导图
isBorder: false,
onTap: _controller.meetingDetails.value.tasktype >= 5 && onTap: _controller.meetingDetails.value.tasktype >= 5 &&
_controller.meetingDetails.value.tasktype < 10001 _controller.meetingDetails.value.tasktype < 10001
? () async { ? () {
Get.back(); Get.back();
Get.bottomSheet( final mindMapController =
SecondLevelBottomSheet( Get.find<MindMapController>();
'exportSummary'.tr, // 对应中文:导出总结 mindMapController.imageType = 2;
'exportAs'.tr, // 对应中文:导出为 if (mindMapController.isWebViewReady) {
(int index) async { mindMapController.webViewController
if (index == 0) { .runJavaScript('captureImage()');
// 导出TXT } else {
final tempDir = mindMapController.webViewController
await getTemporaryDirectory(); .setNavigationDelegate(
final file = File( NavigationDelegate(
'${tempDir.path}/${_controller.meetingData.value.title}_summary.txt'); onPageFinished: (String url) {
await file.writeAsString( mindMapController.isWebViewReady = true;
_markdownToPlainText(_controller mindMapController.webViewController
.meetingDetails.value.summary)); .runJavaScript('captureImage()');
_share(file.path,
'exportSummary'.tr); // 对应中文:分享会议总结
} else {
// 导出PDF
_exportMarkdownPdf();
}
},
const [
{
'icon': Icons.text_snippet,
'title': 'TXT',
'isBorder': true,
}, },
{
'icon': Icons.picture_as_pdf,
'title': 'PDF',
'isBorder': false,
},
],
),
isScrollControlled: true,
backgroundColor: Colors.grey[100],
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(
top: Radius.circular(12.r),
), ),
), );
); }
}
: null),
_shareItem(
Icons.save_alt,
'保存思维导图',
onTap: _controller.meetingDetails.value.tasktype >= 5 &&
_controller.meetingDetails.value.tasktype < 10001
? () {
Get.back();
final mindMapController =
Get.find<MindMapController>();
mindMapController.imageType = 1;
if (mindMapController.isWebViewReady) {
mindMapController.webViewController
.runJavaScript('captureImage()');
} else {
mindMapController.webViewController
.setNavigationDelegate(
NavigationDelegate(
onPageFinished: (String url) {
mindMapController.isWebViewReady = true;
mindMapController.webViewController
.runJavaScript('captureImage()');
},
),
);
}
}
: null,
),
_shareItem(
Icons.lan,
'shareMindMap'.tr, // 对应中文:分享思维导图
isBorder: false,
onTap: _controller.meetingDetails.value.tasktype >= 5 &&
_controller.meetingDetails.value.tasktype < 10001
? () {
Get.back();
final mindMapController =
Get.find<MindMapController>();
mindMapController.imageType = 2;
if (mindMapController.isWebViewReady) {
mindMapController.webViewController
.runJavaScript('captureImage()');
} else {
mindMapController.webViewController
.setNavigationDelegate(
NavigationDelegate(
onPageFinished: (String url) {
mindMapController.isWebViewReady = true;
mindMapController.webViewController
.runJavaScript('captureImage()');
},
),
);
} }
} : null,
: null, ),
), ]),
]), ],
], ),
), ),
),
], ],
), ),
), ),

Loading…
Cancel
Save