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",
"enterInviteLinkOrMatrixId": "Enter invite link or Matrix ID...",
"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
: () => controller.removeDevicesAction(
controller.notThisDevice),
)
else
Center(
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Text(L10n.of(context)!.noOtherDevicesFound),
),
),
const Divider(height: 1),
],

View File

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