Skip to content

Commit cd24076

Browse files
feat(devices): enhance device name display for current device
1 parent a812f01 commit cd24076

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

open_wearable/lib/widgets/devices/connect_devices_page.dart

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,9 @@ class _ConnectDevicesPageState extends State<ConnectDevicesPage> {
181181
leading: Icon(
182182
isThisDevice ? Icons.smartphone : Icons.bluetooth,
183183
),
184-
title: PlatformText(_deviceName(device)),
184+
title: PlatformText(
185+
_deviceName(device, isThisDevice: isThisDevice),
186+
),
185187
subtitle: PlatformText(device.id),
186188
trailing: _buildTrailingWidget(
187189
device,
@@ -342,10 +344,16 @@ class _ConnectDevicesPageState extends State<ConnectDevicesPage> {
342344
);
343345
}
344346

345-
String _deviceName(DiscoveredDevice device) {
347+
String _deviceName(DiscoveredDevice device, {required bool isThisDevice}) {
346348
final name = device.name.trim();
347-
if (name.isEmpty) return 'Unnamed device';
348-
return formatWearableDisplayName(name);
349+
final displayName =
350+
name.isEmpty ? 'Unnamed device' : formatWearableDisplayName(name);
351+
352+
if (isThisDevice) {
353+
return '$displayName (this device)';
354+
}
355+
356+
return displayName;
349357
}
350358

351359
String _formatScanTime(DateTime startedAt) {

0 commit comments

Comments
 (0)