Skip to content

Commit 152c60a

Browse files
authored
SUpport clicking on a link to open a file saved to the device. (#395)
1 parent b0ceacc commit 152c60a

File tree

3 files changed

+82
-2
lines changed

3 files changed

+82
-2
lines changed

extras/webClient/lib/view/files_page.dart

+16-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
import 'dart:async';
2+
13
import 'package:flutter/material.dart';
24
import 'package:provider/provider.dart';
35
import 'package:tank_manager/model/app_data.dart';
6+
import 'package:url_launcher/url_launcher.dart';
47

58
class Files extends StatelessWidget {
69
const Files({
@@ -21,7 +24,19 @@ class Files extends StatelessWidget {
2124
(fileName, fileSize) => fileRows.add(
2225
DataRow(
2326
cells: <DataCell>[
24-
DataCell(Text(fileName.toString())),
27+
DataCell(
28+
GestureDetector(
29+
onTap: () {
30+
String ip = appData.currentTank.ip;
31+
String file = fileName.toString();
32+
String loc = 'http://$ip/$file';
33+
unawaited(launchUrl(Uri.parse(loc)));
34+
},
35+
child: Text(
36+
fileName.toString(),
37+
),
38+
),
39+
),
2540
DataCell(
2641
Container(
2742
alignment: const Alignment(1.0, 0.0),

extras/webClient/pubspec.lock

+65-1
Original file line numberDiff line numberDiff line change
@@ -693,6 +693,70 @@ packages:
693693
url: "https://pub.dev"
694694
source: hosted
695695
version: "2.2.0"
696+
url_launcher:
697+
dependency: "direct main"
698+
description:
699+
name: url_launcher
700+
sha256: eb1e00ab44303d50dd487aab67ebc575456c146c6af44422f9c13889984c00f3
701+
url: "https://pub.dev"
702+
source: hosted
703+
version: "6.1.11"
704+
url_launcher_android:
705+
dependency: transitive
706+
description:
707+
name: url_launcher_android
708+
sha256: eed4e6a1164aa9794409325c3b707ff424d4d1c2a785e7db67f8bbda00e36e51
709+
url: "https://pub.dev"
710+
source: hosted
711+
version: "6.0.35"
712+
url_launcher_ios:
713+
dependency: transitive
714+
description:
715+
name: url_launcher_ios
716+
sha256: "9af7ea73259886b92199f9e42c116072f05ff9bea2dcb339ab935dfc957392c2"
717+
url: "https://pub.dev"
718+
source: hosted
719+
version: "6.1.4"
720+
url_launcher_linux:
721+
dependency: transitive
722+
description:
723+
name: url_launcher_linux
724+
sha256: "207f4ddda99b95b4d4868320a352d374b0b7e05eefad95a4a26f57da413443f5"
725+
url: "https://pub.dev"
726+
source: hosted
727+
version: "3.0.5"
728+
url_launcher_macos:
729+
dependency: transitive
730+
description:
731+
name: url_launcher_macos
732+
sha256: "91ee3e75ea9dadf38036200c5d3743518f4a5eb77a8d13fda1ee5764373f185e"
733+
url: "https://pub.dev"
734+
source: hosted
735+
version: "3.0.5"
736+
url_launcher_platform_interface:
737+
dependency: transitive
738+
description:
739+
name: url_launcher_platform_interface
740+
sha256: "6c9ca697a5ae218ce56cece69d46128169a58aa8653c1b01d26fcd4aad8c4370"
741+
url: "https://pub.dev"
742+
source: hosted
743+
version: "2.1.2"
744+
url_launcher_web:
745+
dependency: transitive
746+
description:
747+
name: url_launcher_web
748+
sha256: "6bb1e5d7fe53daf02a8fee85352432a40b1f868a81880e99ec7440113d5cfcab"
749+
url: "https://pub.dev"
750+
source: hosted
751+
version: "2.0.17"
752+
url_launcher_windows:
753+
dependency: transitive
754+
description:
755+
name: url_launcher_windows
756+
sha256: "254708f17f7c20a9c8c471f67d86d76d4a3f9c1591aad1e15292008aceb82771"
757+
url: "https://pub.dev"
758+
source: hosted
759+
version: "3.0.6"
696760
vector_math:
697761
dependency: transitive
698762
description:
@@ -751,4 +815,4 @@ packages:
751815
version: "3.1.1"
752816
sdks:
753817
dart: ">=3.0.0-0 <4.0.0"
754-
flutter: ">=3.0.0"
818+
flutter: ">=3.3.0"

extras/webClient/pubspec.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ dependencies:
2828
provider: ^6.0.3
2929
shared_preferences: ^2.0.15
3030
universal_html: ^2.2.1
31+
url_launcher: ^6.1.11
3132
version: ^3.0.2
3233

3334
dev_dependencies:

0 commit comments

Comments
 (0)