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.',
// Meeting模块 - 思维导图相关
'saveMindMap': 'Save Mind Map',
'shareMindMap': 'Share Mind Map',
'shareSuccess': 'Share Success',

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

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

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

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

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

@ -609,6 +609,7 @@ const Map<String, String> zhTW = {
'檢測到您已永久拒絕儲存權限。如需繼續使用此功能,請前往應用設定中手動開啟儲存權限。',
// Meeting模块 - 思维导图相关
'saveMindMap': '儲存思維導圖',
'shareMindMap': '分享思維導圖',
'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 '../../../../data/services/version_update_service.dart';
import '../../../../data/services/network/dio_manager.dart';
import '../../controllers/meeting_details_controller.dart';
import '../../controllers/mind_map_controller.dart';
@ -38,237 +37,243 @@ class _ShareBottomSheetState extends State<ShareBottomSheet> {
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Container(
padding: EdgeInsets.symmetric(vertical: 10.w),
child: Row(
children: [
Icon(
Icons.audio_file_outlined,
color: Colors.grey,
size: 32.w,
),
5.horizontalSpace,
Expanded(
child: Text(
_controller.meetingData.value.title,
style: TextStyle(
fontSize: 16.sp,
color: Colors.black87,
),
Container(
padding: EdgeInsets.symmetric(vertical: 10.w),
child: Row(
children: [
Icon(
Icons.audio_file_outlined,
color: Colors.grey,
size: 32.w,
),
),
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],
5.horizontalSpace,
Expanded(
child: Text(
_controller.meetingData.value.title,
style: TextStyle(
fontSize: 16.sp,
color: Colors.black87,
),
),
),
)
],
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: EdgeInsets.symmetric(vertical: 10.w),
child: Column(
children: [
_box([
_shareItem(
Icons.link,
'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, // 对应中文:复制总结
Padding(
padding: EdgeInsets.symmetric(vertical: 10.w),
child: Column(
children: [
_box([
_shareItem(
Icons.link,
'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,
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 &&
_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); // 对应中文:分享会议转写
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.article, 'exportSummary'.tr, // 对应中文:导出总结
: null,
),
_shareItem(
Icons.lan,
'shareMindMap'.tr, // 对应中文:分享思维导图
isBorder: false,
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,
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()');
},
{
'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