From aa92261b9d94ba506201618ad735ea86fdac0129 Mon Sep 17 00:00:00 2001 From: tanlongsheng <252620078@qq.com> Date: Mon, 21 Jul 2025 16:03:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=88=86=E4=BA=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controllers/mind_map_controller.dart | 2 +- .../second_level_bottom_sheet.dart | 164 ++++++++++++++++++ .../views/bottomSheet/share_bottom_sheet.dart | 45 ++++- 3 files changed, 203 insertions(+), 8 deletions(-) create mode 100644 lib/modules/meeting/views/bottomSheet/second_level_bottom_sheet.dart diff --git a/lib/modules/meeting/controllers/mind_map_controller.dart b/lib/modules/meeting/controllers/mind_map_controller.dart index c9d83d25e..b35c53e3e 100644 --- a/lib/modules/meeting/controllers/mind_map_controller.dart +++ b/lib/modules/meeting/controllers/mind_map_controller.dart @@ -170,7 +170,7 @@ class MindMapController extends GetxController { final String base64Str = dataUrl.split(',').last; final Uint8List bytes = base64.decode(base64Str); final String fileName = - '${_meetingDetailsController.meetingData.value.title} mindmap.png'; + '${_meetingDetailsController.meetingData.value.title}_mindmap.png'; final tempDir = await getTemporaryDirectory(); final File file = File('${tempDir.path}/$fileName'); await file.writeAsBytes(bytes); diff --git a/lib/modules/meeting/views/bottomSheet/second_level_bottom_sheet.dart b/lib/modules/meeting/views/bottomSheet/second_level_bottom_sheet.dart new file mode 100644 index 000000000..023056133 --- /dev/null +++ b/lib/modules/meeting/views/bottomSheet/second_level_bottom_sheet.dart @@ -0,0 +1,164 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get.dart'; + +class SecondLevelBottomSheet extends StatefulWidget { + final String title; + final String subtitle; + final Function(int index) onTap; + final List children; + + const SecondLevelBottomSheet( + this.title, this.subtitle, this.onTap, this.children, + {super.key}); + + @override + State createState() => _SecondLevelBottomSheetState(); +} + +class _SecondLevelBottomSheetState extends State { + int _selectedIndex = 0; + + @override + Widget build(BuildContext context) { + return Padding( + padding: EdgeInsets.symmetric(horizontal: 12.w), + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + padding: EdgeInsets.symmetric(vertical: 10.w), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + widget.title, + style: TextStyle( + fontSize: 16.sp, + color: Colors.black87, + fontWeight: FontWeight.bold, + ), + ), + 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], + ), + ), + ) + ], + ), + ), + Divider( + height: 1, + color: Colors.grey[300], + ), + Padding( + padding: EdgeInsetsGeometry.only( + top: 20.w, + bottom: 10.w, + left: 12.w, + ), + child: Text( + widget.subtitle, + style: TextStyle( + fontSize: 14.sp, + color: Colors.grey[600], + ), + ), + ), + Container( + clipBehavior: Clip.hardEdge, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(12.r), + ), + child: Column( + children: List.generate(widget.children.length, (int index) { + Map item = widget.children[index]; + return InkWell( + onTap: () { + setState(() { + _selectedIndex = index; + }); + }, + child: Container( + padding: + EdgeInsets.symmetric(horizontal: 12.w, vertical: 14.w), + decoration: BoxDecoration( + border: item['isBorder'] + ? Border( + bottom: BorderSide( + width: 0.5, + color: Colors.grey[300]!, + ), + ) + : null, + ), + child: Row( + children: [ + Icon( + item['icon'], + color: Colors.black87, + ), + 10.horizontalSpace, + Expanded( + child: Text( + item['title'], + style: TextStyle( + fontSize: 14.sp, + color: Colors.black87, + ), + ), + ), + if (_selectedIndex == index) + const Icon( + Icons.check, + color: Colors.black87, + ), + ], + ), + ), + ); + }), + ), + ), + Padding( + padding: EdgeInsets.symmetric(vertical: 20.w), + child: GestureDetector( + onTap: () { + Get.back(); + widget.onTap(_selectedIndex); + }, + child: Container( + height: 48.w, + alignment: Alignment.center, + decoration: BoxDecoration( + color: Colors.black, + borderRadius: BorderRadius.circular(12.r), + ), + child: Text( + '导出', + style: TextStyle( + fontSize: 16.sp, + color: Colors.white, + ), + ), + ), + ), + ), + ], + ), + ); + } +} diff --git a/lib/modules/meeting/views/bottomSheet/share_bottom_sheet.dart b/lib/modules/meeting/views/bottomSheet/share_bottom_sheet.dart index bd5b1f26f..19a6144eb 100644 --- a/lib/modules/meeting/views/bottomSheet/share_bottom_sheet.dart +++ b/lib/modules/meeting/views/bottomSheet/share_bottom_sheet.dart @@ -14,6 +14,7 @@ import 'package:webview_flutter/webview_flutter.dart'; import '../../../../core/utils/synchrodata.dart'; import '../../controllers/meeting_details_controller.dart'; import '../../controllers/mind_map_controller.dart'; +import 'second_level_bottom_sheet.dart'; class ShareBottomSheet extends StatefulWidget { const ShareBottomSheet({super.key}); @@ -141,7 +142,7 @@ class _ShareBottomSheetState extends State { Get.back(); final tempDir = await getTemporaryDirectory(); final file = File( - '${tempDir.path}/${_controller.meetingData.value.title} speaker.txt'); + '${tempDir.path}/${_controller.meetingData.value.title}_speaker.txt'); String allText = _getAllText(); await file.writeAsString(allText); _share(file.path, '分享会议转写'); @@ -151,12 +152,42 @@ class _ShareBottomSheetState extends State { onTap: _controller.meetingDetails.value.tasktype >= 3 ? () async { Get.back(); - final tempDir = await getTemporaryDirectory(); - final file = File( - '${tempDir.path}/${_controller.meetingData.value.title} summary.txt'); - await file.writeAsString( - _controller.meetingDetails.value.summary); - _share(file.path, '分享会议总结'); + Get.bottomSheet( + SecondLevelBottomSheet( + '导出总结', + '导出为', + (int index) async { + if (index == 0) { + final tempDir = + await getTemporaryDirectory(); + final file = File( + '${tempDir.path}/${_controller.meetingData.value.title}_summary.txt'); + await file.writeAsString(_controller + .meetingDetails.value.summary); + _share(file.path, '分享会议总结'); + } else {} + }, + 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(