Skip to content

An open-source cross-platform alternative to AirDrop

feat: open selected file on tap

Tien Do Nam1fb9d1682426
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3ece936f..433aa1fe 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,9 +1,10 @@
## 1.5.0 (2023-01-)
-- feat: allow accepting requests partially
-- feat: allow setting destination directory during accept phase
-- feat: allow renaming incoming files
+- feat: accept requests partially
+- feat: set destination directory during accept phase
+- feat: rename incoming files
- feat: keep screen on during file transfer
+- feat: tap to open selected file before sending
## 1.4.0 (2023-01-06)
diff --git a/lib/pages/selected_files_page.dart b/lib/pages/selected_files_page.dart
index 9b1f7a26..a047221a 100644
--- a/lib/pages/selected_files_page.dart
+++ b/lib/pages/selected_files_page.dart
@@ -9,6 +9,7 @@ import 'package:localsend_app/provider/selection/selected_sending_files_provider
import 'package:localsend_app/util/file_size_helper.dart';
import 'package:localsend_app/widget/file_thumbnail.dart';
import 'package:localsend_app/widget/responsive_list_view.dart';
+import 'package:open_filex/open_filex.dart';
import 'package:routerino/routerino.dart';
class SelectedFilesPage extends ConsumerWidget {
@@ -51,41 +52,50 @@ class SelectedFilesPage extends ConsumerWidget {
(index, file) {
return Padding(
padding: const EdgeInsets.only(bottom: 10),
- child: Card(
- child: Padding(
- padding: const EdgeInsets.all(10),
- child: Row(
- children: [
- FileThumbnail(file),
- const SizedBox(width: 10),
- Expanded(
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- file.fileType == FileType.text && file.bytes != null
- ? '"${utf8.decode(file.bytes!).replaceAll('\n', ' ')}"'
- : file.name,
- maxLines: 1,
- overflow: TextOverflow.fade,
- softWrap: false,
- ),
- Text(file.size.asReadableFileSize, style: Theme.of(context).textTheme.caption),
- ],
+ child: InkWell(
+ splashColor: Colors.transparent,
+ splashFactory: NoSplash.splashFactory,
+ highlightColor: Colors.transparent,
+ hoverColor: Colors.transparent,
+ onTap: file.path != null
+ ? () => OpenFilex.open(file.path)
+ : null,
+ child: Card(
+ child: Padding(
+ padding: const EdgeInsets.all(10),
+ child: Row(
+ children: [
+ FileThumbnail(file),
+ const SizedBox(width: 10),
+ Expanded(
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ file.fileType == FileType.text && file.bytes != null
+ ? '"${utf8.decode(file.bytes!).replaceAll('\n', ' ')}"'
+ : file.name,
+ maxLines: 1,
+ overflow: TextOverflow.fade,
+ softWrap: false,
+ ),
+ Text(file.size.asReadableFileSize, style: Theme.of(context).textTheme.caption),
+ ],
+ ),
),
- ),
- TextButton(
- style: TextButton.styleFrom(foregroundColor: Theme.of(context).colorScheme.onSurface),
- onPressed: () {
- final currCount = ref.read(selectedSendingFilesProvider).length;
- ref.read(selectedSendingFilesProvider.notifier).removeAt(index);
- if (currCount == 1) {
- context.popUntilRoot();
- }
- },
- child: const Icon(Icons.delete),
- ),
- ],
+ TextButton(
+ style: TextButton.styleFrom(foregroundColor: Theme.of(context).colorScheme.onSurface),
+ onPressed: () {
+ final currCount = ref.read(selectedSendingFilesProvider).length;
+ ref.read(selectedSendingFilesProvider.notifier).removeAt(index);
+ if (currCount == 1) {
+ context.popUntilRoot();
+ }
+ },
+ child: const Icon(Icons.delete),
+ ),
+ ],
+ ),
),
),
),