|
|
@ -3,11 +3,13 @@ import 'package:flutter/material.dart'; |
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
|
|
import 'package:get/get.dart'; |
|
|
import 'package:get/get.dart'; |
|
|
import 'package:haptic_feedback/haptic_feedback.dart'; |
|
|
import 'package:haptic_feedback/haptic_feedback.dart'; |
|
|
|
|
|
import 'package:path_provider/path_provider.dart'; |
|
|
|
|
|
|
|
|
import '../../../core/theme/app_colors.dart'; |
|
|
import '../../../core/theme/app_colors.dart'; |
|
|
import '../../../routes/app_routes.dart'; |
|
|
import '../../../routes/app_routes.dart'; |
|
|
import '../controllers/meeting_controller.dart'; |
|
|
import '../controllers/meeting_controller.dart'; |
|
|
import '../model/meeting_model.dart'; |
|
|
import '../model/meeting_model.dart'; |
|
|
|
|
|
import 'dart:io'; |
|
|
|
|
|
|
|
|
class MeetingView extends GetView<MeetingController> { |
|
|
class MeetingView extends GetView<MeetingController> { |
|
|
const MeetingView({super.key}); |
|
|
const MeetingView({super.key}); |
|
|
@ -21,12 +23,444 @@ class MeetingView extends GetView<MeetingController> { |
|
|
appBar: _buildAppBar(isDarkMode), |
|
|
appBar: _buildAppBar(isDarkMode), |
|
|
body: _buildBody(context, isDarkMode), |
|
|
body: _buildBody(context, isDarkMode), |
|
|
floatingActionButton: FloatingActionButton( |
|
|
floatingActionButton: FloatingActionButton( |
|
|
onPressed: controller.addAudio, |
|
|
//onPressed: controller.addAudio, |
|
|
|
|
|
onPressed: () { |
|
|
|
|
|
// 显示底部选择菜单 |
|
|
|
|
|
_showAddAudioMenu(context, isDarkMode); |
|
|
|
|
|
}, |
|
|
child: const Icon(Icons.add), |
|
|
child: const Icon(Icons.add), |
|
|
), |
|
|
), |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// ...existing code... |
|
|
|
|
|
void _showAddAudioMenu(BuildContext context, bool isDarkMode) { |
|
|
|
|
|
showModalBottomSheet( |
|
|
|
|
|
context: context, |
|
|
|
|
|
isScrollControlled: true, |
|
|
|
|
|
backgroundColor: Colors.transparent, |
|
|
|
|
|
builder: (context) { |
|
|
|
|
|
return Padding( |
|
|
|
|
|
padding: EdgeInsets.only( |
|
|
|
|
|
bottom: MediaQuery.of(context).viewInsets.bottom + 30.w, |
|
|
|
|
|
left: 16.w, |
|
|
|
|
|
right: 16.w, |
|
|
|
|
|
), |
|
|
|
|
|
child: Column( |
|
|
|
|
|
mainAxisSize: MainAxisSize.min, |
|
|
|
|
|
children: [ |
|
|
|
|
|
// 录音按钮 |
|
|
|
|
|
Container( |
|
|
|
|
|
margin: EdgeInsets.only(bottom: 12.w), |
|
|
|
|
|
child: GestureDetector( |
|
|
|
|
|
onTap: () { |
|
|
|
|
|
Navigator.of(context).pop(); |
|
|
|
|
|
// TODO: 实现开始录音逻辑 |
|
|
|
|
|
// controller.startRecording(); |
|
|
|
|
|
}, |
|
|
|
|
|
child: Container( |
|
|
|
|
|
height: 56.w, |
|
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
|
color: isDarkMode |
|
|
|
|
|
? Colors.white.withOpacity(0.05) |
|
|
|
|
|
: Colors.grey[100], |
|
|
|
|
|
borderRadius: BorderRadius.circular(28.w), |
|
|
|
|
|
), |
|
|
|
|
|
child: Row( |
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center, |
|
|
|
|
|
children: [ |
|
|
|
|
|
Container( |
|
|
|
|
|
width: 36.w, |
|
|
|
|
|
height: 36.w, |
|
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
|
color: Colors.red.withOpacity(0.15), |
|
|
|
|
|
shape: BoxShape.circle, |
|
|
|
|
|
), |
|
|
|
|
|
child: Icon(Icons.mic, color: Colors.red, size: 24.w), |
|
|
|
|
|
), |
|
|
|
|
|
SizedBox(width: 12.w), |
|
|
|
|
|
Text( |
|
|
|
|
|
'开始录音', |
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
color: isDarkMode ? Colors.white70 : Colors.black87, |
|
|
|
|
|
fontSize: 16.sp, |
|
|
|
|
|
fontWeight: FontWeight.w500, |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
Spacer(), |
|
|
|
|
|
Icon(Icons.arrow_forward_ios, |
|
|
|
|
|
color: Colors.grey, size: 18.w), |
|
|
|
|
|
SizedBox(width: 16.w), |
|
|
|
|
|
], |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
// 导入音频按钮 |
|
|
|
|
|
Container( |
|
|
|
|
|
margin: EdgeInsets.only(bottom: 24.w), |
|
|
|
|
|
child: GestureDetector( |
|
|
|
|
|
onTap: () { |
|
|
|
|
|
Navigator.of(context).pop(); |
|
|
|
|
|
_showImportAudioSheet(context, isDarkMode); |
|
|
|
|
|
}, |
|
|
|
|
|
child: Container( |
|
|
|
|
|
height: 56.w, |
|
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
|
color: isDarkMode |
|
|
|
|
|
? Colors.white.withOpacity(0.10) |
|
|
|
|
|
: Colors.white, |
|
|
|
|
|
borderRadius: BorderRadius.circular(28.w), |
|
|
|
|
|
border: Border.all( |
|
|
|
|
|
color: Colors.blue.withOpacity(0.15), |
|
|
|
|
|
width: 2, |
|
|
|
|
|
), |
|
|
|
|
|
boxShadow: [ |
|
|
|
|
|
BoxShadow( |
|
|
|
|
|
color: Colors.blue.withOpacity(0.08), |
|
|
|
|
|
blurRadius: 8, |
|
|
|
|
|
offset: Offset(0, 2), |
|
|
|
|
|
), |
|
|
|
|
|
], |
|
|
|
|
|
), |
|
|
|
|
|
child: Row( |
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center, |
|
|
|
|
|
children: [ |
|
|
|
|
|
Container( |
|
|
|
|
|
width: 36.w, |
|
|
|
|
|
height: 36.w, |
|
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
|
color: Colors.blue.withOpacity(0.15), |
|
|
|
|
|
shape: BoxShape.circle, |
|
|
|
|
|
), |
|
|
|
|
|
child: Icon(Icons.file_upload_outlined, |
|
|
|
|
|
color: Colors.blue, size: 24.w), |
|
|
|
|
|
), |
|
|
|
|
|
SizedBox(width: 12.w), |
|
|
|
|
|
Text( |
|
|
|
|
|
'导入音频', |
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
color: Colors.blue, |
|
|
|
|
|
fontSize: 16.sp, |
|
|
|
|
|
fontWeight: FontWeight.w500, |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
Spacer(), |
|
|
|
|
|
Icon(Icons.arrow_forward_ios, |
|
|
|
|
|
color: Colors.grey, size: 18.w), |
|
|
|
|
|
SizedBox(width: 16.w), |
|
|
|
|
|
], |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
// 关闭按钮 |
|
|
|
|
|
GestureDetector( |
|
|
|
|
|
onTap: () => Navigator.of(context).pop(), |
|
|
|
|
|
child: Container( |
|
|
|
|
|
width: 56.w, |
|
|
|
|
|
height: 56.w, |
|
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
|
color: isDarkMode |
|
|
|
|
|
? Colors.white.withOpacity(0.08) |
|
|
|
|
|
: Colors.black.withOpacity(0.08), |
|
|
|
|
|
shape: BoxShape.circle, |
|
|
|
|
|
), |
|
|
|
|
|
child: Icon(Icons.close, |
|
|
|
|
|
color: isDarkMode ? Colors.white : Colors.black54, |
|
|
|
|
|
size: 32.w), |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
SizedBox(height: 10.w), |
|
|
|
|
|
], |
|
|
|
|
|
), |
|
|
|
|
|
); |
|
|
|
|
|
}, |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
|
|
|
// ...existing code... |
|
|
|
|
|
|
|
|
|
|
|
// 新增:本地音视频文件选择弹窗 |
|
|
|
|
|
void _showLocalAudioVideoPicker(BuildContext context, bool isDarkMode) async { |
|
|
|
|
|
// 这里以用户目录下的 Downloads 为例,可根据实际需求修改路径 |
|
|
|
|
|
|
|
|
|
|
|
final directory = Directory( |
|
|
|
|
|
'/storage/emulated/0/Android/data/com.yunqiinnovation.deepsound/files'); |
|
|
|
|
|
final List<FileSystemEntity> files = directory |
|
|
|
|
|
.listSync() |
|
|
|
|
|
.where((f) => |
|
|
|
|
|
f is File && |
|
|
|
|
|
(f.path.endsWith('.mp3') || |
|
|
|
|
|
f.path.endsWith('.wav') || |
|
|
|
|
|
f.path.endsWith('.aac') || |
|
|
|
|
|
f.path.endsWith('.m4a') || |
|
|
|
|
|
f.path.endsWith('.mp4') || |
|
|
|
|
|
f.path.endsWith('.mov'))) |
|
|
|
|
|
.toList(); |
|
|
|
|
|
|
|
|
|
|
|
List<String> selected = []; |
|
|
|
|
|
|
|
|
|
|
|
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: files.length, |
|
|
|
|
|
itemBuilder: (context, idx) { |
|
|
|
|
|
final file = files[idx]; |
|
|
|
|
|
final fileName = file.path.split('/').last; |
|
|
|
|
|
final isChecked = selected.contains(file.path); |
|
|
|
|
|
return CheckboxListTile( |
|
|
|
|
|
value: isChecked, |
|
|
|
|
|
onChanged: (checked) { |
|
|
|
|
|
setState(() { |
|
|
|
|
|
if (checked == true) { |
|
|
|
|
|
selected.add(file.path); |
|
|
|
|
|
} else { |
|
|
|
|
|
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: selected.isEmpty |
|
|
|
|
|
? null |
|
|
|
|
|
: () { |
|
|
|
|
|
Navigator.of(context).pop(); |
|
|
|
|
|
// TODO: 调用导入逻辑 |
|
|
|
|
|
// controller.importFiles(selected); |
|
|
|
|
|
}, |
|
|
|
|
|
child: |
|
|
|
|
|
Text('导入选中', style: TextStyle(color: Colors.white)), |
|
|
|
|
|
), |
|
|
|
|
|
], |
|
|
|
|
|
), |
|
|
|
|
|
SizedBox(height: 8.w), |
|
|
|
|
|
], |
|
|
|
|
|
), |
|
|
|
|
|
); |
|
|
|
|
|
}, |
|
|
|
|
|
); |
|
|
|
|
|
}, |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// ...existing code... |
|
|
|
|
|
void _showImportAudioSheet(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(); |
|
|
|
|
|
controller.addAudio(); |
|
|
|
|
|
// 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(); |
|
|
|
|
|
_showLocalAudioVideoPicker(context, isDarkMode); |
|
|
|
|
|
// 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(); |
|
|
|
|
|
// TODO: 实现从其他APP导入逻辑 |
|
|
|
|
|
}, |
|
|
|
|
|
), |
|
|
|
|
|
], |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
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), |
|
|
|
|
|
], |
|
|
|
|
|
), |
|
|
|
|
|
); |
|
|
|
|
|
}, |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Widget _importAudioItem( |
|
|
|
|
|
BuildContext context, |
|
|
|
|
|
bool isDarkMode, { |
|
|
|
|
|
required Widget icon, |
|
|
|
|
|
required String title, |
|
|
|
|
|
required VoidCallback onTap, |
|
|
|
|
|
}) { |
|
|
|
|
|
return Material( |
|
|
|
|
|
color: Colors.transparent, |
|
|
|
|
|
child: InkWell( |
|
|
|
|
|
borderRadius: BorderRadius.circular(12.w), |
|
|
|
|
|
onTap: onTap, |
|
|
|
|
|
child: Container( |
|
|
|
|
|
height: 52.w, |
|
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 12.w), |
|
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
|
color: |
|
|
|
|
|
isDarkMode ? Colors.white.withOpacity(0.03) : Colors.grey[50], |
|
|
|
|
|
borderRadius: BorderRadius.circular(12.w), |
|
|
|
|
|
), |
|
|
|
|
|
child: Row( |
|
|
|
|
|
children: [ |
|
|
|
|
|
icon, |
|
|
|
|
|
SizedBox(width: 14.w), |
|
|
|
|
|
Expanded( |
|
|
|
|
|
child: Text( |
|
|
|
|
|
title, |
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
fontSize: 16.sp, |
|
|
|
|
|
color: isDarkMode ? Colors.white : Colors.black87, |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
Icon(Icons.arrow_forward_ios, size: 18.w, color: Colors.grey), |
|
|
|
|
|
], |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
|
|
|
// ...existing code... |
|
|
|
|
|
|
|
|
// 构建应用栏 |
|
|
// 构建应用栏 |
|
|
PreferredSizeWidget _buildAppBar(bool isDarkMode) { |
|
|
PreferredSizeWidget _buildAppBar(bool isDarkMode) { |
|
|
return AppBar( |
|
|
return AppBar( |
|
|
|