|
|
|
@ -9,31 +9,36 @@ import '../../../core/theme/app_colors.dart'; |
|
|
|
import '../../../routes/app_routes.dart'; |
|
|
|
import '../controllers/meeting_controller.dart'; |
|
|
|
import '../model/meeting_model.dart'; |
|
|
|
import 'dart:io'; |
|
|
|
import 'meeting_record_view.dart'; |
|
|
|
|
|
|
|
class MeetingView extends GetView<MeetingController> { |
|
|
|
const MeetingView({super.key}); |
|
|
|
|
|
|
|
static OverlayEntry? _recordingOverlayEntry; |
|
|
|
@override |
|
|
|
Widget build(BuildContext context) { |
|
|
|
final isDarkMode = Theme.of(context).brightness == Brightness.dark; |
|
|
|
|
|
|
|
return Scaffold( |
|
|
|
backgroundColor: isDarkMode ? Colors.black : Colors.grey[50], |
|
|
|
appBar: _buildAppBar(isDarkMode), |
|
|
|
appBar: _buildAppBar(context, isDarkMode), |
|
|
|
body: _buildBody(context, isDarkMode), |
|
|
|
floatingActionButton: FloatingActionButton( |
|
|
|
//onPressed: controller.addAudio, |
|
|
|
onPressed: () { |
|
|
|
// 显示底部选择菜单 |
|
|
|
_showAddAudioMenu(context, isDarkMode); |
|
|
|
}, |
|
|
|
child: const Icon(Icons.add), |
|
|
|
floatingActionButton: Column( |
|
|
|
mainAxisSize: MainAxisSize.min, |
|
|
|
crossAxisAlignment: CrossAxisAlignment.end, |
|
|
|
children: [ |
|
|
|
FloatingActionButton( |
|
|
|
heroTag: "addAudio", |
|
|
|
onPressed: () { |
|
|
|
_showAddAudioMenu(context, isDarkMode); |
|
|
|
}, |
|
|
|
child: const Icon(Icons.add), |
|
|
|
), |
|
|
|
], |
|
|
|
), |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
// ...existing code... |
|
|
|
// 底部+号菜单 |
|
|
|
void _showAddAudioMenu(BuildContext context, bool isDarkMode) { |
|
|
|
showModalBottomSheet( |
|
|
|
context: context, |
|
|
|
@ -56,7 +61,7 @@ class MeetingView extends GetView<MeetingController> { |
|
|
|
onTap: () { |
|
|
|
Navigator.of(context).pop(); |
|
|
|
// TODO: 实现开始录音逻辑 |
|
|
|
// controller.startRecording(); |
|
|
|
_showStartsRecordSheet(context, isDarkMode); |
|
|
|
}, |
|
|
|
child: Container( |
|
|
|
height: 56.w, |
|
|
|
@ -178,7 +183,114 @@ class MeetingView extends GetView<MeetingController> { |
|
|
|
}, |
|
|
|
); |
|
|
|
} |
|
|
|
// ...existing code... |
|
|
|
|
|
|
|
// 新增:从opus导出选择弹窗 |
|
|
|
void _showLocalOpusPicker(BuildContext context, bool isDarkMode) async { |
|
|
|
// 这里以用户目录下的 Downloads 为例,可根据实际需求修改路径 |
|
|
|
controller.loadTranslatopus(); |
|
|
|
showModalBottomSheet( |
|
|
|
context: context, |
|
|
|
isScrollControlled: true, |
|
|
|
backgroundColor: Colors.transparent, |
|
|
|
builder: (context) { |
|
|
|
return StatefulBuilder( |
|
|
|
builder: (context, setState) { |
|
|
|
return Container( |
|
|
|
decoration: BoxDecoration( |
|
|
|
color: isDarkMode ? Colors.grey[900] : Colors.white, |
|
|
|
borderRadius: BorderRadius.vertical(top: Radius.circular(18.w)), |
|
|
|
), |
|
|
|
padding: EdgeInsets.only( |
|
|
|
left: 0, |
|
|
|
right: 0, |
|
|
|
top: 12.w, |
|
|
|
bottom: MediaQuery.of(context).viewInsets.bottom + 12.w, |
|
|
|
), |
|
|
|
child: Column( |
|
|
|
mainAxisSize: MainAxisSize.min, |
|
|
|
children: [ |
|
|
|
Text( |
|
|
|
'选择音视频文件', |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 18.sp, |
|
|
|
fontWeight: FontWeight.bold, |
|
|
|
color: isDarkMode ? Colors.white : Colors.black87, |
|
|
|
), |
|
|
|
), |
|
|
|
Divider( |
|
|
|
height: 1, |
|
|
|
color: isDarkMode ? Colors.white12 : Colors.grey[200]), |
|
|
|
SizedBox(height: 8.w), |
|
|
|
SizedBox( |
|
|
|
height: 300.w, |
|
|
|
child: ListView.builder( |
|
|
|
itemCount: controller.files.length, |
|
|
|
itemBuilder: (context, idx) { |
|
|
|
final file = controller.files[idx]; |
|
|
|
final fileName = file.path.split('/').last; |
|
|
|
final isChecked = |
|
|
|
controller.selected.contains(file.path); |
|
|
|
return CheckboxListTile( |
|
|
|
value: isChecked, |
|
|
|
onChanged: (checked) { |
|
|
|
setState(() { |
|
|
|
if (checked == true) { |
|
|
|
controller.selected.add(file.path); |
|
|
|
} else { |
|
|
|
controller.selected.remove(file.path); |
|
|
|
} |
|
|
|
}); |
|
|
|
}, |
|
|
|
title: Text( |
|
|
|
fileName, |
|
|
|
style: TextStyle( |
|
|
|
color: isDarkMode ? Colors.white : Colors.black87, |
|
|
|
fontSize: 15.sp, |
|
|
|
), |
|
|
|
), |
|
|
|
controlAffinity: ListTileControlAffinity.leading, |
|
|
|
activeColor: Colors.blue, |
|
|
|
); |
|
|
|
}, |
|
|
|
), |
|
|
|
), |
|
|
|
SizedBox(height: 12.w), |
|
|
|
Row( |
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly, |
|
|
|
children: [ |
|
|
|
ElevatedButton( |
|
|
|
style: ElevatedButton.styleFrom( |
|
|
|
backgroundColor: Colors.grey, |
|
|
|
), |
|
|
|
onPressed: () => Navigator.of(context).pop(), |
|
|
|
child: |
|
|
|
Text('取消', style: TextStyle(color: Colors.white)), |
|
|
|
), |
|
|
|
ElevatedButton( |
|
|
|
style: ElevatedButton.styleFrom( |
|
|
|
backgroundColor: Colors.blue, |
|
|
|
), |
|
|
|
onPressed: controller.selected.isEmpty |
|
|
|
? null |
|
|
|
: () { |
|
|
|
Navigator.of(context).pop(); |
|
|
|
// TODO: 调用导入逻辑 |
|
|
|
controller.shareAllTranslatAudio(); |
|
|
|
}, |
|
|
|
child: |
|
|
|
Text('导入选中', style: TextStyle(color: Colors.white)), |
|
|
|
), |
|
|
|
], |
|
|
|
), |
|
|
|
SizedBox(height: 8.w), |
|
|
|
], |
|
|
|
), |
|
|
|
); |
|
|
|
}, |
|
|
|
); |
|
|
|
}, |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
// 新增:本地音视频文件选择弹窗 |
|
|
|
void _showLocalAudioVideoPicker(BuildContext context, bool isDarkMode) async { |
|
|
|
@ -288,7 +400,7 @@ class MeetingView extends GetView<MeetingController> { |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
// ...existing code... |
|
|
|
// 导入音频弹窗 |
|
|
|
void _showImportAudioSheet(BuildContext context, bool isDarkMode) { |
|
|
|
showModalBottomSheet( |
|
|
|
context: context, |
|
|
|
@ -371,9 +483,128 @@ class MeetingView extends GetView<MeetingController> { |
|
|
|
width: 20.w, height: 20.w), |
|
|
|
], |
|
|
|
), |
|
|
|
title: '从录音里导入', |
|
|
|
title: '从opus导出', |
|
|
|
onTap: () { |
|
|
|
Navigator.of(context).pop(); |
|
|
|
// TODO: 实现从其他APP导入逻辑 |
|
|
|
_showLocalOpusPicker(context, isDarkMode); |
|
|
|
}, |
|
|
|
), |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
SizedBox(height: 8.w), |
|
|
|
Padding( |
|
|
|
padding: EdgeInsets.symmetric(horizontal: 20.w), |
|
|
|
child: Text( |
|
|
|
'支持导入单文件时长不超过5小时的音频', |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 13.sp, |
|
|
|
color: isDarkMode ? Colors.white54 : Colors.grey[600], |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
SizedBox(height: 16.w), |
|
|
|
GestureDetector( |
|
|
|
onTap: () => Navigator.of(context).pop(), |
|
|
|
child: Icon(Icons.close, size: 32.w, color: Colors.grey), |
|
|
|
), |
|
|
|
SizedBox(height: 8.w), |
|
|
|
], |
|
|
|
), |
|
|
|
); |
|
|
|
}, |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
// 开始录音弹窗 |
|
|
|
void _showStartsRecordSheet(BuildContext context, bool isDarkMode) { |
|
|
|
showModalBottomSheet( |
|
|
|
context: context, |
|
|
|
isScrollControlled: true, |
|
|
|
backgroundColor: Colors.transparent, |
|
|
|
builder: (context) { |
|
|
|
return Container( |
|
|
|
decoration: BoxDecoration( |
|
|
|
color: isDarkMode ? Colors.grey[900] : Colors.white, |
|
|
|
borderRadius: BorderRadius.vertical(top: Radius.circular(18.w)), |
|
|
|
), |
|
|
|
padding: EdgeInsets.only( |
|
|
|
left: 0, |
|
|
|
right: 0, |
|
|
|
top: 12.w, |
|
|
|
bottom: MediaQuery.of(context).viewInsets.bottom + 12.w, |
|
|
|
), |
|
|
|
child: Column( |
|
|
|
mainAxisSize: MainAxisSize.min, |
|
|
|
children: [ |
|
|
|
Container( |
|
|
|
alignment: Alignment.centerLeft, |
|
|
|
padding: EdgeInsets.symmetric(horizontal: 24.w, vertical: 8.w), |
|
|
|
child: Text( |
|
|
|
'开始录音', |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 18.sp, |
|
|
|
fontWeight: FontWeight.bold, |
|
|
|
color: isDarkMode ? Colors.white : Colors.black87, |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
Divider( |
|
|
|
height: 1, |
|
|
|
color: isDarkMode ? Colors.white12 : Colors.grey[200]), |
|
|
|
// 选项列表 |
|
|
|
Padding( |
|
|
|
padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 8.w), |
|
|
|
child: Column( |
|
|
|
children: [ |
|
|
|
_importAudioItem( |
|
|
|
context, |
|
|
|
isDarkMode, |
|
|
|
icon: Image.asset('assets/images/explore.png', |
|
|
|
width: 32.w, height: 32.w), |
|
|
|
title: '音/视频录音', |
|
|
|
onTap: () { |
|
|
|
Navigator.of(context).pop(); |
|
|
|
Get.toNamed(Routes.meetingRecord); |
|
|
|
// TODO: 实现从文件导入逻辑 |
|
|
|
}, |
|
|
|
), |
|
|
|
SizedBox(height: 8.w), |
|
|
|
_importAudioItem( |
|
|
|
context, |
|
|
|
isDarkMode, |
|
|
|
icon: Image.asset('assets/images/explore.png', |
|
|
|
width: 32.w, height: 32.w), |
|
|
|
title: '现场录音', |
|
|
|
onTap: () { |
|
|
|
Navigator.of(context).pop(); |
|
|
|
Get.toNamed(Routes.meetingRecord); |
|
|
|
|
|
|
|
// TODO: 实现从相册导入逻辑 |
|
|
|
}, |
|
|
|
), |
|
|
|
SizedBox(height: 8.w), |
|
|
|
_importAudioItem( |
|
|
|
context, |
|
|
|
isDarkMode, |
|
|
|
icon: Row( |
|
|
|
mainAxisSize: MainAxisSize.min, |
|
|
|
children: [ |
|
|
|
Image.asset('assets/images/explore.png', |
|
|
|
width: 20.w, height: 20.w), |
|
|
|
SizedBox(width: 4.w), |
|
|
|
Image.asset('assets/images/explore.png', |
|
|
|
width: 20.w, height: 20.w), |
|
|
|
SizedBox(width: 4.w), |
|
|
|
Image.asset('assets/images/explore.png', |
|
|
|
width: 20.w, height: 20.w), |
|
|
|
], |
|
|
|
), |
|
|
|
title: '通话录音', |
|
|
|
onTap: () { |
|
|
|
Navigator.of(context).pop(); |
|
|
|
Get.toNamed(Routes.meetingRecord); |
|
|
|
// TODO: 实现从其他APP导入逻辑 |
|
|
|
}, |
|
|
|
), |
|
|
|
@ -404,6 +635,7 @@ class MeetingView extends GetView<MeetingController> { |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
// 选项框 |
|
|
|
Widget _importAudioItem( |
|
|
|
BuildContext context, |
|
|
|
bool isDarkMode, { |
|
|
|
@ -444,10 +676,120 @@ class MeetingView extends GetView<MeetingController> { |
|
|
|
), |
|
|
|
); |
|
|
|
} |
|
|
|
// ...existing code... |
|
|
|
|
|
|
|
// 新增右侧弹窗 |
|
|
|
|
|
|
|
void _showRightDrawerDialog(BuildContext context, bool isDarkMode) { |
|
|
|
showGeneralDialog( |
|
|
|
context: context, |
|
|
|
barrierDismissible: true, |
|
|
|
barrierLabel: "rightDrawer", |
|
|
|
transitionDuration: const Duration(milliseconds: 300), |
|
|
|
pageBuilder: (context, anim1, anim2) { |
|
|
|
return Align( |
|
|
|
alignment: Alignment.centerRight, |
|
|
|
child: FractionallySizedBox( |
|
|
|
widthFactor: 0.7, |
|
|
|
child: Material( |
|
|
|
color: Colors.transparent, |
|
|
|
child: Container( |
|
|
|
height: MediaQuery.of(context).size.height, |
|
|
|
decoration: BoxDecoration( |
|
|
|
color: isDarkMode ? Colors.white : Colors.white, |
|
|
|
borderRadius: BorderRadius.only( |
|
|
|
topLeft: Radius.circular(18.w), |
|
|
|
bottomLeft: Radius.circular(18.w), |
|
|
|
), |
|
|
|
), |
|
|
|
child: _buildDrawerContent(context, isDarkMode), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
); |
|
|
|
}, |
|
|
|
transitionBuilder: (context, anim1, anim2, child) { |
|
|
|
final offsetAnimation = Tween<Offset>( |
|
|
|
begin: const Offset(1, 0), |
|
|
|
end: Offset.zero, |
|
|
|
).animate(CurvedAnimation(parent: anim1, curve: Curves.easeOutCubic)); |
|
|
|
return SlideTransition( |
|
|
|
position: offsetAnimation, |
|
|
|
child: child, |
|
|
|
); |
|
|
|
}, |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
// 侧边栏内容 |
|
|
|
Widget _buildDrawerContent(BuildContext context, bool isDarkMode) { |
|
|
|
return SafeArea( |
|
|
|
child: Column( |
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
children: [ |
|
|
|
Padding( |
|
|
|
padding: EdgeInsets.all(20.w), |
|
|
|
child: TextField( |
|
|
|
decoration: InputDecoration( |
|
|
|
hintText: '在所有文件中搜索', |
|
|
|
prefixIcon: Icon(Icons.search), |
|
|
|
border: OutlineInputBorder( |
|
|
|
borderRadius: BorderRadius.circular(12.w), |
|
|
|
borderSide: BorderSide.none, |
|
|
|
), |
|
|
|
filled: true, |
|
|
|
fillColor: Colors.grey[100], |
|
|
|
contentPadding: EdgeInsets.zero, |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
ListTile( |
|
|
|
leading: Icon(Icons.folder, color: Colors.red), |
|
|
|
title: |
|
|
|
Text('全部文件(4)', style: TextStyle(fontWeight: FontWeight.bold)), |
|
|
|
onTap: () {}, |
|
|
|
), |
|
|
|
ListTile( |
|
|
|
leading: Icon(Icons.category, color: Colors.blue), |
|
|
|
title: Text('未分类(4)'), |
|
|
|
onTap: () {}, |
|
|
|
), |
|
|
|
ListTile( |
|
|
|
leading: Icon(Icons.delete, color: Colors.teal), |
|
|
|
title: Text('回收站'), |
|
|
|
onTap: () {}, |
|
|
|
), |
|
|
|
Divider(), |
|
|
|
Padding( |
|
|
|
padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 8.w), |
|
|
|
child: Text('文件夹', style: TextStyle(color: Colors.grey)), |
|
|
|
), |
|
|
|
...['NOTE', 'CALL', 'NotePin', 'Import', 'Desktop'] |
|
|
|
.map((name) => ListTile( |
|
|
|
title: Text(name), |
|
|
|
onTap: () {}, |
|
|
|
)), |
|
|
|
Divider(), |
|
|
|
Padding( |
|
|
|
padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 8.w), |
|
|
|
child: Text('排序方式', style: TextStyle(color: Colors.grey)), |
|
|
|
), |
|
|
|
ListTile( |
|
|
|
title: Text('创建时间'), |
|
|
|
trailing: Icon(Icons.arrow_upward), |
|
|
|
onTap: () {}, |
|
|
|
), |
|
|
|
ListTile( |
|
|
|
title: Text('修改时间'), |
|
|
|
trailing: Icon(Icons.arrow_upward), |
|
|
|
onTap: () {}, |
|
|
|
), |
|
|
|
], |
|
|
|
), |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
// 构建应用栏 |
|
|
|
PreferredSizeWidget _buildAppBar(bool isDarkMode) { |
|
|
|
PreferredSizeWidget _buildAppBar(BuildContext context, bool isDarkMode) { |
|
|
|
return AppBar( |
|
|
|
backgroundColor: isDarkMode ? Colors.black : Colors.white, |
|
|
|
elevation: 0.5, |
|
|
|
@ -468,6 +810,15 @@ class MeetingView extends GetView<MeetingController> { |
|
|
|
), |
|
|
|
), |
|
|
|
centerTitle: true, |
|
|
|
actions: [ |
|
|
|
IconButton( |
|
|
|
icon: Icon(Icons.folder_open, |
|
|
|
color: isDarkMode ? Colors.white : Colors.black), |
|
|
|
onPressed: () { |
|
|
|
_showRightDrawerDialog(context, isDarkMode); |
|
|
|
}, |
|
|
|
), |
|
|
|
], |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
@ -809,4 +1160,19 @@ class MeetingView extends GetView<MeetingController> { |
|
|
|
clipBehavior: Clip.hardEdge, |
|
|
|
); |
|
|
|
} |
|
|
|
// ...existing code... |
|
|
|
|
|
|
|
// void _showRecordingSheet(BuildContext context, bool isDarkMode) { |
|
|
|
// if (_recordingOverlayEntry != null) return; // 防止重复添加 |
|
|
|
// _recordingOverlayEntry = OverlayEntry( |
|
|
|
// builder: (ctx) => RecordingFloatingPanel( |
|
|
|
// onStop: () { |
|
|
|
// _recordingOverlayEntry?.remove(); |
|
|
|
// _recordingOverlayEntry = null; |
|
|
|
// // 录音完成后的逻辑 |
|
|
|
// }, |
|
|
|
// ), |
|
|
|
// ); |
|
|
|
// Overlay.of(context).insert(_recordingOverlayEntry!); |
|
|
|
// } |
|
|
|
} |
|
|
|
|