Browse Source

Merge branch 'new_dev' of https://github.com/deepcloud2048/deep_voice into new_dev

newdev_shunjiawei
liwei1dao 1 year ago
parent
commit
f324ffb148
  1. 15
      lib/data/services/meeting/meeting_upload_service.dart
  2. 18
      lib/modules/meeting/controllers/meeting_connect_controller.dart
  3. 2
      lib/modules/meeting/controllers/meeting_controller.dart
  4. 13
      lib/modules/meeting/controllers/meeting_home_controller.dart
  5. 12
      lib/modules/meeting/views/meeting_home_view.dart
  6. 170
      lib/modules/meeting/views/meeting_view.dart

15
lib/data/services/meeting/meeting_upload_service.dart

@ -26,10 +26,15 @@ class MeetingUploadService extends GetxService {
void _getUploadList() { void _getUploadList() {
uploadList.value = _storage.read("meeting_upload_list") ?? []; uploadList.value = _storage.read("meeting_upload_list") ?? [];
_executeUpload(); executeUpload();
} }
void addUpload(int id, String filePath, String rootDir) async { void addUpload(
int id,
String filePath,
String rootDir, {
bool isUpload = true,
}) async {
uploadList.add({ uploadList.add({
'id': id, 'id': id,
'filepath': filePath, 'filepath': filePath,
@ -38,10 +43,12 @@ class MeetingUploadService extends GetxService {
'isTask': false, 'isTask': false,
}); });
_storage.write("meeting_upload_list", uploadList); _storage.write("meeting_upload_list", uploadList);
_executeUpload(); if (isUpload) {
executeUpload();
}
} }
void _executeUpload() async { void executeUpload() async {
if (_isUpload) return; if (_isUpload) return;
_isUpload = true; _isUpload = true;
_handled = 0; _handled = 0;

18
lib/modules/meeting/controllers/meeting_connect_controller.dart

@ -7,6 +7,7 @@ import 'package:path_provider/path_provider.dart';
import 'package:wifi_iot/wifi_iot.dart'; import 'package:wifi_iot/wifi_iot.dart';
import '../../../core/utils/ftpconnect/ftpconnect.dart'; import '../../../core/utils/ftpconnect/ftpconnect.dart';
import '../../../data/services/meeting/meeting_upload_service.dart';
import 'meeting_home_controller.dart'; import 'meeting_home_controller.dart';
class MeetingConnectController extends GetxController { class MeetingConnectController extends GetxController {
@ -69,7 +70,6 @@ class MeetingConnectController extends GetxController {
_scanResultsSubscription.cancel(); _scanResultsSubscription.cancel();
_isScanningSubscription.cancel(); _isScanningSubscription.cancel();
_valueReceivedSubscription?.cancel(); _valueReceivedSubscription?.cancel();
_ftpConnect?.disconnect();
_stopScan(); _stopScan();
_disconnect(); _disconnect();
super.onClose(); super.onClose();
@ -100,6 +100,7 @@ class MeetingConnectController extends GetxController {
} }
Future<void> _disconnect() async { Future<void> _disconnect() async {
_ftpConnect?.disconnect();
await WiFiForIoTPlugin.forceWifiUsage(false); await WiFiForIoTPlugin.forceWifiUsage(false);
await WiFiForIoTPlugin.disconnect(); await WiFiForIoTPlugin.disconnect();
await _device?.disconnect(); await _device?.disconnect();
@ -233,10 +234,11 @@ class MeetingConnectController extends GetxController {
await _downloadFile(totalSize, previousSize, element); await _downloadFile(totalSize, previousSize, element);
await _ftpConnect?.deleteFile(element.name); await _ftpConnect?.deleteFile(element.name);
} }
await _disconnect();
stateStr.value = '下载完成'; stateStr.value = '下载完成';
importedFilesStr.value = '下载完成,共${listDirectory.length}个文件,2秒后自动返回'; importedFilesStr.value = '下载完成,共${listDirectory.length}个文件,2秒后自动返回';
_disconnect();
Future.delayed(const Duration(seconds: 2), () { Future.delayed(const Duration(seconds: 2), () {
_executeUpload();
Get.back(); Get.back();
}); });
} }
@ -262,7 +264,17 @@ class MeetingConnectController extends GetxController {
fileSize.value = size; fileSize.value = size;
}, },
); );
await _meetingController.insertMeetingAudio(entry.name, filePath); await _meetingController.insertMeetingAudio(
entry.name,
filePath,
isUpload: false,
);
}
Future<void> _executeUpload() async {
await Future.delayed(const Duration(seconds: 3));
final meetingUploadService = Get.find<MeetingUploadService>();
meetingUploadService.executeUpload();
} }
String _decodePassword(List<int> data) { String _decodePassword(List<int> data) {

2
lib/modules/meeting/controllers/meeting_controller.dart

@ -15,6 +15,8 @@ class MeetingController extends GetxController {
const MeetingMineView(), const MeetingMineView(),
]; ];
int type = 1;
RxInt pageIndex = 0.obs; RxInt pageIndex = 0.obs;
RxMap user = {}.obs; RxMap user = {}.obs;

13
lib/modules/meeting/controllers/meeting_home_controller.dart

@ -327,7 +327,11 @@ class MeetingHomeController extends GetxController {
EasyLoading.dismiss(); EasyLoading.dismiss();
} }
Future insertMeetingAudio(String fileName, String filePath) async { Future insertMeetingAudio(
String fileName,
String filePath, {
bool isUpload = true,
}) async {
await _audioPlayer.setAudioSource(AudioSource.file(filePath)); await _audioPlayer.setAudioSource(AudioSource.file(filePath));
int seconds = _audioPlayer.duration?.inSeconds ?? 0; int seconds = _audioPlayer.duration?.inSeconds ?? 0;
int creationTime = DateTime.now().millisecondsSinceEpoch; int creationTime = DateTime.now().millisecondsSinceEpoch;
@ -342,7 +346,12 @@ class MeetingHomeController extends GetxController {
}; };
final meetingId = await SqfliteApi.insertMeeting(data); final meetingId = await SqfliteApi.insertMeeting(data);
if (meetingId != null) { if (meetingId != null) {
meetingUploadService.addUpload(meetingId, filePath, 'ExternalAudio'); meetingUploadService.addUpload(
meetingId,
filePath,
'ExternalAudio',
isUpload: isUpload,
);
originalDataList.insert(0, { originalDataList.insert(0, {
'id': meetingId, 'id': meetingId,
...data, ...data,

12
lib/modules/meeting/views/meeting_home_view.dart

@ -87,8 +87,8 @@ class _MeetingHomeViewState extends State<MeetingHomeView>
vertical: 10.w, vertical: 10.w,
), ),
decoration: BoxDecoration( decoration: BoxDecoration(
color: isDarkMode color: isDarkMode
? MeetingUIUtils.getTranslucentWhite(0.05) ? MeetingUIUtils.getTranslucentWhite(0.05)
: MeetingUIUtils.getCardColor(isDarkMode), : MeetingUIUtils.getCardColor(isDarkMode),
borderRadius: BorderRadius.circular(12.w), borderRadius: BorderRadius.circular(12.w),
boxShadow: MeetingUIUtils.getCardShadow(isDarkMode), boxShadow: MeetingUIUtils.getCardShadow(isDarkMode),
@ -127,8 +127,8 @@ class _MeetingHomeViewState extends State<MeetingHomeView>
vertical: 10.w, vertical: 10.w,
), ),
decoration: BoxDecoration( decoration: BoxDecoration(
color: isDarkMode color: isDarkMode
? MeetingUIUtils.getTranslucentWhite(0.05) ? MeetingUIUtils.getTranslucentWhite(0.05)
: MeetingUIUtils.getCardColor(isDarkMode), : MeetingUIUtils.getCardColor(isDarkMode),
borderRadius: BorderRadius.circular(50.w), borderRadius: BorderRadius.circular(50.w),
boxShadow: MeetingUIUtils.getCardShadow(isDarkMode), boxShadow: MeetingUIUtils.getCardShadow(isDarkMode),
@ -220,8 +220,8 @@ class _MeetingHomeViewState extends State<MeetingHomeView>
padding: EdgeInsets.symmetric(horizontal: 15.w, vertical: 10.w), padding: EdgeInsets.symmetric(horizontal: 15.w, vertical: 10.w),
margin: EdgeInsets.symmetric(vertical: 5.w), margin: EdgeInsets.symmetric(vertical: 5.w),
decoration: BoxDecoration( decoration: BoxDecoration(
color: isDarkMode color: isDarkMode
? MeetingUIUtils.getTranslucentWhite(0.05) ? MeetingUIUtils.getTranslucentWhite(0.05)
: MeetingUIUtils.getCardColor(isDarkMode), : MeetingUIUtils.getCardColor(isDarkMode),
borderRadius: BorderRadius.circular(12.w), borderRadius: BorderRadius.circular(12.w),
boxShadow: MeetingUIUtils.getCardShadow(isDarkMode), boxShadow: MeetingUIUtils.getCardShadow(isDarkMode),

170
lib/modules/meeting/views/meeting_view.dart

@ -30,93 +30,97 @@ class MeetingView extends GetView<MeetingController> {
child: const FiltrateDrawer(), child: const FiltrateDrawer(),
), ),
drawerEnableOpenDragGesture: false, drawerEnableOpenDragGesture: false,
bottomNavigationBar: Stack( bottomNavigationBar: controller.type == 0
alignment: Alignment.center, ? Stack(
clipBehavior: Clip.none, alignment: Alignment.center,
children: [ clipBehavior: Clip.none,
Obx( children: [
() => BottomNavigationBar( Obx(
items: const [ () => BottomNavigationBar(
BottomNavigationBarItem( items: const [
icon: Icon(Icons.folder_outlined), BottomNavigationBarItem(
activeIcon: Icon(Icons.folder), icon: Icon(Icons.folder_outlined),
label: '文件', activeIcon: Icon(Icons.folder),
), label: '文件',
BottomNavigationBarItem( ),
icon: SizedBox(), BottomNavigationBarItem(
label: '', icon: SizedBox(),
), label: '',
BottomNavigationBarItem( ),
icon: Icon(Icons.person_outline), BottomNavigationBarItem(
activeIcon: Icon(Icons.person), icon: Icon(Icons.person_outline),
label: '我的', activeIcon: Icon(Icons.person),
), label: '我的',
], ),
backgroundColor: ],
isDarkMode ? const Color(0xFF1A1A1A) : Colors.white, backgroundColor:
currentIndex: controller.pageIndex.value, isDarkMode ? const Color(0xFF1A1A1A) : Colors.white,
unselectedItemColor: Colors.grey, currentIndex: controller.pageIndex.value,
selectedItemColor: isDarkMode ? Colors.white : Colors.blue, unselectedItemColor: Colors.grey,
unselectedFontSize: 10.sp, selectedItemColor: isDarkMode ? Colors.white : Colors.blue,
selectedFontSize: 10.sp, unselectedFontSize: 10.sp,
onTap: (int index) { selectedFontSize: 10.sp,
if (index == 1 || index == controller.pageIndex.value) return; onTap: (int index) {
if (index == 0) { if (index == 1 || index == controller.pageIndex.value)
controller.pageIndex.value = 0; return;
controller.pageController.jumpToPage(0); if (index == 0) {
} else { controller.pageIndex.value = 0;
controller.pageIndex.value = 2; controller.pageController.jumpToPage(0);
controller.pageController.jumpToPage(1); } else {
} controller.pageIndex.value = 2;
}, controller.pageController.jumpToPage(1);
), }
), },
Positioned(
top: -18.w,
child: GestureDetector(
onTap: () {
Get.bottomSheet(
BackdropFilter(
filter: ImageFilter.blur(sigmaX: 10.0, sigmaY: 10.0),
child: const NavigationBarBottomSheet(),
), ),
isScrollControlled: true,
);
},
child: Container(
width: 60.w,
height: 60.w,
padding: EdgeInsets.all(5.w),
alignment: Alignment.center,
decoration: BoxDecoration(
color: isDarkMode ? const Color(0xFF1A1A1A) : Colors.white,
borderRadius: BorderRadius.circular(60.w),
boxShadow: [
BoxShadow(
color: Colors.black
.withValues(alpha: isDarkMode ? 0.3 : 0.1),
blurRadius: 8,
offset: const Offset(0, 2),
),
],
), ),
child: Container( Positioned(
alignment: Alignment.center, top: -18.w,
decoration: BoxDecoration( child: GestureDetector(
color: MeetingUIUtils.getButtonColor(isDarkMode), onTap: () {
borderRadius: BorderRadius.circular(60.w), Get.bottomSheet(
), BackdropFilter(
child: Icon( filter: ImageFilter.blur(sigmaX: 10.0, sigmaY: 10.0),
Icons.add, child: const NavigationBarBottomSheet(),
color: Colors.white, ),
size: 30.w, isScrollControlled: true,
);
},
child: Container(
width: 60.w,
height: 60.w,
padding: EdgeInsets.all(5.w),
alignment: Alignment.center,
decoration: BoxDecoration(
color:
isDarkMode ? const Color(0xFF1A1A1A) : Colors.white,
borderRadius: BorderRadius.circular(60.w),
boxShadow: [
BoxShadow(
color: Colors.black
.withValues(alpha: isDarkMode ? 0.3 : 0.1),
blurRadius: 8,
offset: const Offset(0, 2),
),
],
),
child: Container(
alignment: Alignment.center,
decoration: BoxDecoration(
color: MeetingUIUtils.getButtonColor(isDarkMode),
borderRadius: BorderRadius.circular(60.w),
),
child: Icon(
Icons.add,
color: Colors.white,
size: 30.w,
),
),
),
), ),
), ),
), ],
), )
), : null,
],
),
); );
} }
} }

Loading…
Cancel
Save