diff --git a/ui/flutter/lib/app/modules/task/views/task_files_view.dart b/ui/flutter/lib/app/modules/task/views/task_files_view.dart index 053c2d37..e62fc59a 100644 --- a/ui/flutter/lib/app/modules/task/views/task_files_view.dart +++ b/ui/flutter/lib/app/modules/task/views/task_files_view.dart @@ -89,7 +89,7 @@ class TaskFilesView extends GetView { return [ IconButton( icon: - const Icon(Icons.play_circle), + const Icon(Icons.open_in_new), onPressed: () { launchUrl(Uri.parse(accessUrl), webOnlyWindowName: @@ -106,12 +106,7 @@ class TaskFilesView extends GetView { IconButton( icon: const Icon(Icons.play_circle), onPressed: () async { - print(filePath); - try { - await OpenFilex.open(filePath); - } catch (e) { - print(e); - } + await OpenFilex.open(filePath); }), IconButton( icon: const Icon(Icons.share), diff --git a/ui/flutter/lib/app/views/buid_task_list_view.dart b/ui/flutter/lib/app/views/buid_task_list_view.dart index 42c81754..a80b0b3b 100644 --- a/ui/flutter/lib/app/views/buid_task_list_view.dart +++ b/ui/flutter/lib/app/views/buid_task_list_view.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:get/get.dart'; +import 'package:open_filex/open_filex.dart'; import 'package:path/path.dart' as path; import 'package:styled_widget/styled_widget.dart'; @@ -57,8 +58,12 @@ class BuildTaskListView extends GetView { return task.status == Status.running; } + bool isFolderTask() { + return task.meta.res?.name.isNotEmpty ?? false; + } + String buildExplorerUrl(Task task) { - if (task.meta.res!.name.isEmpty) { + if (!isFolderTask()) { return path.join(Util.safeDir(task.meta.opts.path), Util.safeDir(task.meta.res!.files[0].path), fileName(task.meta)); } else { @@ -107,18 +112,22 @@ class BuildTaskListView extends GetView { )); } + toTaskFilesView() { + if (Util.isDesktop()) { + FileExplorer.openAndSelectFile(buildExplorerUrl(task)); + } else { + Get.rootDelegate + .toNamed(Routes.TASK_FILES, parameters: {'id': task.id}); + } + } + List buildActions() { final list = []; if (isDone()) { list.add(IconButton( icon: const Icon(Icons.folder_open), onPressed: () { - if (Util.isDesktop()) { - FileExplorer.openAndSelectFile(buildExplorerUrl(task)); - } else { - Get.rootDelegate - .toNamed(Routes.TASK_FILES, parameters: {'id': task.id}); - } + toTaskFilesView(); }, )); } else { @@ -176,14 +185,23 @@ class BuildTaskListView extends GetView { elevation: 4.0, child: InkWell( onTap: () {}, + onDoubleTap: () { + if (isDone()) { + if (isFolderTask()) { + toTaskFilesView(); + } else { + OpenFilex.open(buildExplorerUrl(task)); + } + } + }, child: Column( mainAxisSize: MainAxisSize.min, children: [ ListTile( title: Text(fileName(task.meta)), - leading: (task.meta.res?.name.isNotEmpty ?? false + leading: isFolderTask() ? const Icon(FaIcons.folder) - : Icon(FaIcons.allIcons[findIcon(fileName(task.meta))]))), + : Icon(FaIcons.allIcons[findIcon(fileName(task.meta))])), Row( children: [ Expanded(