From 40addfe0d49d58b6ab5d9b9eb8da9a2c4614cc38 Mon Sep 17 00:00:00 2001 From: tanlongsheng <252620078@qq.com> Date: Mon, 7 Jul 2025 22:04:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BC=9A=E8=AE=AE=E5=8A=A9?= =?UTF-8?q?=E6=89=8B=E4=B8=8B=E8=BD=BD=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../meeting_connect_controller.dart | 18 ++++++++++++------ .../meeting/views/meeting_connect_view.dart | 15 +-------------- lib/modules/meeting/views/meeting_view.dart | 3 ++- 3 files changed, 15 insertions(+), 21 deletions(-) diff --git a/lib/modules/meeting/controllers/meeting_connect_controller.dart b/lib/modules/meeting/controllers/meeting_connect_controller.dart index 26acb44c1..cd155e352 100644 --- a/lib/modules/meeting/controllers/meeting_connect_controller.dart +++ b/lib/modules/meeting/controllers/meeting_connect_controller.dart @@ -14,7 +14,6 @@ class MeetingConnectController extends GetxController { RxString stateStr = '搜索中...'.obs; RxBool isRescan = false.obs; - RxBool isImportedFiles = false.obs; RxString importedFilesStr = ''.obs; late StreamSubscription> _scanResultsSubscription; @@ -151,10 +150,10 @@ class MeetingConnectController extends GetxController { switch (command) { case 0x0d: // 是否有导入文件 if (value[3] == 0x01) { - isImportedFiles.value = true; - importedFilesStr.value = '检查到有新文件,是否导入'; + stateStr.value = '正在开启Wi-Fi...'; + importedFilesStr.value = '检查到有新文件,正在准备导入'; + sendData([0x5a, 0x02, 0x87, 0x01]); } else { - isImportedFiles.value = false; importedFilesStr.value = '没有新文件需要导入'; } break; @@ -220,19 +219,25 @@ class MeetingConnectController extends GetxController { _ftpConnect?.listCommand = ListCommand.LIST; List? listDirectory = await _ftpConnect?.listDirectoryContent(); if (listDirectory != null && listDirectory.isNotEmpty) { + stateStr.value = '正在下载文件...'; isDownload.value = true; int totalSize = listDirectory.fold( 0, (sum, entry) => sum + (entry.size ?? 0), ); for (var i = 0; i < listDirectory.length; i++) { - stateStr.value = '共${listDirectory.length}个文件,正在下载第${i + 1}个文件...'; + importedFilesStr.value = + '共${listDirectory.length}个文件,正在下载第${i + 1}个文件'; int previousSize = i > 0 ? listDirectory[i - 1].size ?? 0 : 0; FTPEntry element = listDirectory[i]; await _downloadFile(totalSize, previousSize, element); } - stateStr.value = '下载完成,共${listDirectory.length}个文件'; + stateStr.value = '下载完成'; + importedFilesStr.value = '下载完成,共${listDirectory.length}个文件,2秒后自动返回'; _disconnect(); + Future.delayed(const Duration(seconds: 2), () { + Get.back(); + }); } } } @@ -249,6 +254,7 @@ class MeetingConnectController extends GetxController { await _ftpConnect?.downloadFileWithRetry( entry.name, localFile, + pRetryCount: 3, onProgress: (double progress, int received, int size) { downloadProgress.value = (previousSize + received) / totalSize; totalReceived.value = received; diff --git a/lib/modules/meeting/views/meeting_connect_view.dart b/lib/modules/meeting/views/meeting_connect_view.dart index 8adae6f11..82c3e3d97 100644 --- a/lib/modules/meeting/views/meeting_connect_view.dart +++ b/lib/modules/meeting/views/meeting_connect_view.dart @@ -76,26 +76,13 @@ class MeetingConnectView extends GetView { ), ), ), - Obx( - () => controller.isImportedFiles.value - ? Padding( - padding: EdgeInsets.symmetric(vertical: 10.w), - child: _button('导入文件', Icons.file_download, onTap: () { - controller.stateStr.value = '正在开启Wi-Fi...'; - controller.importedFilesStr.value = ''; - controller.isImportedFiles.value = false; - controller.sendData([0x5a, 0x02, 0x87, 0x01]); - }), - ) - : const SizedBox(), - ), Obx(() => controller.isDownload.value ? Column( children: [ Container( width: 300.w, height: 3.w, - margin: EdgeInsets.only(bottom: 10.w), + margin: EdgeInsets.symmetric(vertical: 10.w), child: LinearProgressIndicator( value: controller.downloadProgress.value, valueColor: diff --git a/lib/modules/meeting/views/meeting_view.dart b/lib/modules/meeting/views/meeting_view.dart index db4fe3ba8..33ee92176 100644 --- a/lib/modules/meeting/views/meeting_view.dart +++ b/lib/modules/meeting/views/meeting_view.dart @@ -423,6 +423,7 @@ class MeetingView extends GetView { PreferredSizeWidget _buildAppBar(BuildContext context, bool isDarkMode) { return AppBar( backgroundColor: isDarkMode ? Colors.black : Colors.white, + surfaceTintColor: Colors.transparent, elevation: 0.5, leading: IconButton( icon: Icon( @@ -459,7 +460,7 @@ class MeetingView extends GetView { () => ListView.builder( controller: controller.listController, itemCount: controller.dataList.length, - padding: EdgeInsets.symmetric(horizontal: 12.w, vertical: 5.w), + padding: EdgeInsets.fromLTRB(12.w, 5.w, 12.w, 90.w), itemBuilder: (BuildContext context, int index) { MeetingModel data = MeetingModel.fromJson(controller.dataList[index]); return _item(context, isDarkMode, data);