You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
160 lines
4.5 KiB
160 lines
4.5 KiB
import 'package:flutter/material.dart';
|
|
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:share_plus/share_plus.dart';
|
|
|
|
import '../controllers/meeting_details_controller.dart';
|
|
|
|
class ShareBottomSheet extends StatefulWidget {
|
|
const ShareBottomSheet({super.key});
|
|
|
|
@override
|
|
State<ShareBottomSheet> createState() => _ShareBottomSheetState();
|
|
}
|
|
|
|
class _ShareBottomSheetState extends State<ShareBottomSheet> {
|
|
final _controller = Get.find<MeetingDetailsController>();
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Padding(
|
|
padding: EdgeInsets.symmetric(horizontal: 12.w),
|
|
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,
|
|
),
|
|
),
|
|
),
|
|
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, '分享链接', isBorder: false),
|
|
]),
|
|
_box([
|
|
_shareItem(Icons.copy, '复制转写'),
|
|
_shareItem(Icons.copy, '复制总结', isBorder: false),
|
|
]),
|
|
_box([
|
|
_shareItem(
|
|
Icons.multitrack_audio,
|
|
'导出音频',
|
|
onTap: shareAllTranslatAudio,
|
|
),
|
|
_shareItem(Icons.message, '导出转写'),
|
|
_shareItem(Icons.article, '导出总结'),
|
|
_shareItem(Icons.lan, '导出思维导图', isBorder: false),
|
|
]),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget _box(List<Widget> children) {
|
|
return Container(
|
|
margin: EdgeInsets.only(bottom: 10.w),
|
|
decoration: BoxDecoration(
|
|
color: Colors.white,
|
|
borderRadius: BorderRadius.circular(12.r),
|
|
),
|
|
child: Column(
|
|
children: children,
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget _shareItem(
|
|
IconData icon,
|
|
String title, {
|
|
bool isBorder = true,
|
|
VoidCallback? onTap,
|
|
}) {
|
|
return InkWell(
|
|
onTap: onTap,
|
|
child: Container(
|
|
padding: EdgeInsets.symmetric(horizontal: 12.w, vertical: 15.w),
|
|
decoration: BoxDecoration(
|
|
border: isBorder
|
|
? Border(
|
|
bottom: BorderSide(
|
|
color: Colors.grey[300]!,
|
|
),
|
|
)
|
|
: null,
|
|
),
|
|
child: Row(
|
|
children: [
|
|
Icon(
|
|
icon,
|
|
color: Colors.black87,
|
|
),
|
|
10.horizontalSpace,
|
|
Expanded(
|
|
child: Text(
|
|
title,
|
|
style: TextStyle(
|
|
fontSize: 14.sp,
|
|
color: Colors.black87,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
void shareAllTranslatAudio() async {
|
|
if (_controller.meetingData.value.filepath.isEmpty) {
|
|
EasyLoading.showToast('没有可分享的音频文件');
|
|
return;
|
|
}
|
|
final result = await SharePlus.instance.share(ShareParams(
|
|
text: '分享会议音频',
|
|
files: [XFile(_controller.meetingData.value.filepath)],
|
|
));
|
|
if (result.status == ShareResultStatus.success) {
|
|
EasyLoading.showToast('分享完成!');
|
|
}
|
|
}
|
|
}
|
|
|