Skip to content

An open-source cross-platform alternative to AirDrop

feat: device detail

Tien Do Nam51a0f1ec02e8
diff --git a/app/assets/i18n/en.json b/app/assets/i18n/en.json
index eb7be77c..98e91701 100644
--- a/app/assets/i18n/en.json
+++ b/app/assets/i18n/en.json
@@ -213,7 +213,9 @@
"verify": "Verify",
"info": {
"name": "Name",
- "address": "Address"
+ "address": "Address",
+ "version": "Version",
+ "protocol": "Protocol v{version}"
},
"logs": {
"title": "Logs",
@@ -225,7 +227,8 @@
"verifyPage": {
"title": "Verify",
"icons": "Icons",
- "raw": "Raw"
+ "raw": "Raw",
+ "question": "Does it look the same on the other device?"
},
"receivePage": {
"subTitle": {
diff --git a/app/lib/gen/strings.g.dart b/app/lib/gen/strings.g.dart
index 74ddbbcb..868525b4 100644
--- a/app/lib/gen/strings.g.dart
+++ b/app/lib/gen/strings.g.dart
@@ -4,7 +4,7 @@
/// To regenerate, run: `dart run slang`
///
/// Locales: 55
-/// Strings: 18572 (337 per locale)
+/// Strings: 18575 (337 per locale)
// coverage:ignore-file
// ignore_for_file: type=lint, unused_import
diff --git a/app/lib/gen/strings_en.g.dart b/app/lib/gen/strings_en.g.dart
index 89cc8dae..d44ae058 100644
--- a/app/lib/gen/strings_en.g.dart
+++ b/app/lib/gen/strings_en.g.dart
@@ -427,6 +427,9 @@ class Translations$verifyPage$en {
/// en: 'Raw'
String get raw => 'Raw';
+
+ /// en: 'Does it look the same on the other device?'
+ String get question => 'Does it look the same on the other device?';
}
// Path: receivePage
@@ -1322,6 +1325,12 @@ class Translations$deviceDetailsPage$info$en {
/// en: 'Address'
String get address => 'Address';
+
+ /// en: 'Version'
+ String get version => 'Version';
+
+ /// en: 'Protocol v{version}'
+ String protocol({required Object version}) => 'Protocol v${version}';
}
// Path: deviceDetailsPage.logs
diff --git a/app/lib/pages/device_details_page.dart b/app/lib/pages/device_details_page.dart
index 80298939..2a0c34ae 100644
--- a/app/lib/pages/device_details_page.dart
+++ b/app/lib/pages/device_details_page.dart
@@ -78,7 +78,7 @@ class _DeviceDetailsPageState extends State<DeviceDetailsPage> with Refena {
BigButton(
icon: favoriteEntry != null ? Icons.favorite : Icons.favorite_border,
label: t.deviceDetailsPage.favorite,
- filled: false,
+ filled: favoriteEntry != null,
onTap: () async => await _toggleFavorite(favoriteEntry),
),
const SizedBox(width: 20),
@@ -99,6 +99,7 @@ class _DeviceDetailsPageState extends State<DeviceDetailsPage> with Refena {
children: [
for (final entry in {
t.deviceDetailsPage.info.name: device.alias,
+ t.deviceDetailsPage.info.version: t.deviceDetailsPage.info.protocol(version: device.version),
if (device.ip != null) t.deviceDetailsPage.info.address: '${device.ip}:${device.port}',
}.entries)
TableRow(
diff --git a/app/lib/pages/tabs/send_tab.dart b/app/lib/pages/tabs/send_tab.dart
index 68ced8ec..4088edb3 100644
--- a/app/lib/pages/tabs/send_tab.dart
+++ b/app/lib/pages/tabs/send_tab.dart
@@ -216,11 +216,13 @@ class SendTab extends StatelessWidget {
child: vm.sendMode == SendMode.multiple
? _MultiSendDeviceListTile(
device: device,
+ isFavorite: favoriteEntry != null,
nameOverride: favoriteEntry?.alias,
vm: vm,
)
: DeviceListTile(
device: device,
+ isFavorite: favoriteEntry != null,
nameOverride: favoriteEntry?.alias,
onDetailsTap: () async => await context.push(() => DeviceDetailsPage(device: device)),
onTap: () async => await vm.onTapDevice(context, device),
@@ -513,11 +515,13 @@ class _SendModeButton extends StatelessWidget {
/// An advanced list tile which shows the progress of the file transfer.
class _MultiSendDeviceListTile extends StatelessWidget {
final Device device;
+ final bool isFavorite;
final String? nameOverride;
final SendTabVm vm;
const _MultiSendDeviceListTile({
required this.device,
+ required this.isFavorite,
required this.nameOverride,
required this.vm,
});
@@ -548,6 +552,7 @@ class _MultiSendDeviceListTile extends StatelessWidget {
device: device,
info: info,
progress: progress,
+ isFavorite: isFavorite,
nameOverride: nameOverride,
onDetailsTap: () async => await context.push(() => DeviceDetailsPage(device: device)),
onTap: () async => await vm.onTapDeviceMultiSend(context, device),
diff --git a/app/lib/pages/verify_page.dart b/app/lib/pages/verify_page.dart
index a4b56fbb..f7300fc3 100644
--- a/app/lib/pages/verify_page.dart
+++ b/app/lib/pages/verify_page.dart
@@ -66,6 +66,14 @@ class _VerifyPageState extends State<VerifyPage> {
),
_VerifyMode.raw => SelectableText(combined),
},
+ const SizedBox(height: 20),
+ Center(
+ child: Text(
+ t.verifyPage.question,
+ textAlign: TextAlign.center,
+ style: Theme.of(context).textTheme.bodyMedium?.copyWith(color: Theme.of(context).colorScheme.onSurfaceVariant),
+ ),
+ ),
],
),
);
diff --git a/app/lib/widget/list_tile/device_list_tile.dart b/app/lib/widget/list_tile/device_list_tile.dart
index 9e74eabb..fabf179b 100644
--- a/app/lib/widget/list_tile/device_list_tile.dart
+++ b/app/lib/widget/list_tile/device_list_tile.dart
@@ -7,6 +7,7 @@ import 'package:localsend_isolates/model/device.dart';
class DeviceListTile extends StatelessWidget {
final Device device;
+ final bool isFavorite;
/// If not null, this name is used instead of [Device.alias].
/// This is the case when the device is marked as favorite.
@@ -19,6 +20,7 @@ class DeviceListTile extends StatelessWidget {
const DeviceListTile({
required this.device,
+ this.isFavorite = false,
this.nameOverride,
this.info,
this.progress,
@@ -31,7 +33,16 @@ class DeviceListTile extends StatelessWidget {
final badgeColor = Color.lerp(Theme.of(context).colorScheme.secondaryContainer, Colors.white, 0.3)!;
return CustomListTile(
icon: Icon(device.deviceType.icon, size: 46),
- title: Text(nameOverride ?? device.alias, style: const TextStyle(fontSize: 20)),
+ title: Row(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ Text(nameOverride ?? device.alias, style: const TextStyle(fontSize: 20)),
+ if (isFavorite) ...[
+ const SizedBox(width: 5),
+ Icon(Icons.check_circle, size: 16),
+ ],
+ ],
+ ),
trailing: onDetailsTap != null
? IconButton(
icon: const Icon(Icons.info_outline),
@@ -54,7 +65,7 @@ class DeviceListTile extends StatelessWidget {
DeviceBadge(
backgroundColor: badgeColor,
foregroundColor: Theme.of(context).colorScheme.onSecondaryContainer,
- label: 'LAN • HTTP',
+ label: 'HTTP',
)
else
DeviceBadge(