style: Enhance user device settings design

This commit is contained in:
Krille 2023-02-05 10:41:28 +01:00
parent 2ccc30879b
commit cef5fbe3c8
3 changed files with 19 additions and 10 deletions

View File

@ -2517,5 +2517,6 @@
"letsStart": "Let's start", "letsStart": "Let's start",
"enterInviteLinkOrMatrixId": "Enter invite link or Matrix ID...", "enterInviteLinkOrMatrixId": "Enter invite link or Matrix ID...",
"reopenChat": "Reopen chat", "reopenChat": "Reopen chat",
"noBackupWarning": "Warning! Without enabling chat backup, you will lose access to your encrypted messages. It is highly recommended to enable the chat backup first before logging out." "noBackupWarning": "Warning! Without enabling chat backup, you will lose access to your encrypted messages. It is highly recommended to enable the chat backup first before logging out.",
"noOtherDevicesFound": "No other devices found"
} }

View File

@ -69,6 +69,13 @@ class DevicesSettingsView extends StatelessWidget {
? null ? null
: () => controller.removeDevicesAction( : () => controller.removeDevicesAction(
controller.notThisDevice), controller.notThisDevice),
)
else
Center(
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Text(L10n.of(context)!.noOtherDevicesFound),
),
), ),
const Divider(height: 1), const Divider(height: 1),
], ],

View File

@ -36,10 +36,10 @@ class UserDeviceListItem extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final keys = Matrix.of(context) final client = Matrix.of(context).client;
.client final keys = client.userDeviceKeys[Matrix.of(context).client.userID]
.userDeviceKeys[Matrix.of(context).client.userID]
?.deviceKeys[userDevice.deviceId]; ?.deviceKeys[userDevice.deviceId];
final isOwnDevice = userDevice.deviceId == client.deviceID;
return ListTile( return ListTile(
onTap: () async { onTap: () async {
@ -51,7 +51,7 @@ class UserDeviceListItem extends StatelessWidget {
key: UserDeviceListItemAction.rename, key: UserDeviceListItemAction.rename,
label: L10n.of(context)!.changeDeviceName, label: L10n.of(context)!.changeDeviceName,
), ),
if (keys != null) ...{ if (!isOwnDevice && keys != null) ...{
SheetAction( SheetAction(
key: UserDeviceListItemAction.verify, key: UserDeviceListItemAction.verify,
label: L10n.of(context)!.verifyStart, label: L10n.of(context)!.verifyStart,
@ -69,11 +69,12 @@ class UserDeviceListItem extends StatelessWidget {
isDestructiveAction: true, isDestructiveAction: true,
), ),
}, },
SheetAction( if (!isOwnDevice)
key: UserDeviceListItemAction.remove, SheetAction(
label: L10n.of(context)!.delete, key: UserDeviceListItemAction.remove,
isDestructiveAction: true, label: L10n.of(context)!.delete,
), isDestructiveAction: true,
),
], ],
); );
if (action == null) return; if (action == null) return;