design: Adjust settings design

This commit is contained in:
krille-chan 2024-04-14 11:48:51 +02:00
commit e11195f4fc
No known key found for this signature in database
14 changed files with 217 additions and 116 deletions

View file

@ -58,6 +58,7 @@ class SettingsSecurityController extends State<SettingsSecurity> {
message: L10n.of(context)!.deactivateAccountWarning,
okLabel: L10n.of(context)!.ok,
cancelLabel: L10n.of(context)!.cancel,
isDestructiveAction: true,
) ==
OkCancelResult.cancel) {
return;
@ -74,6 +75,7 @@ class SettingsSecurityController extends State<SettingsSecurity> {
: L10n.of(context)!.supposedMxid(supposedMxid),
),
],
isDestructiveAction: true,
okLabel: L10n.of(context)!.delete,
cancelLabel: L10n.of(context)!.cancel,
);
@ -86,6 +88,7 @@ class SettingsSecurityController extends State<SettingsSecurity> {
title: L10n.of(context)!.pleaseEnterYourPassword,
okLabel: L10n.of(context)!.ok,
cancelLabel: L10n.of(context)!.cancel,
isDestructiveAction: true,
textFields: [
const DialogTextField(
obscureText: true,

View file

@ -42,95 +42,15 @@ class SettingsSecurityView extends StatelessWidget {
}
return Column(
children: [
if (error != null)
ListTile(
leading: const Icon(
Icons.warning_outlined,
color: Colors.orange,
),
title: Text(
error.toLocalizedString(context),
style: const TextStyle(color: Colors.orange),
),
),
if (capabilities?.mChangePassword?.enabled != false ||
error != null) ...[
ListTile(
leading: const Icon(Icons.key_outlined),
trailing: error != null
? null
: const Icon(Icons.chevron_right_outlined),
title: Text(
L10n.of(context)!.changePassword,
style: TextStyle(
decoration:
error == null ? null : TextDecoration.lineThrough,
),
),
onTap: error != null
? null
: () =>
context.go('/rooms/settings/security/password'),
),
ListTile(
leading: const Icon(Icons.mail_outlined),
trailing: error != null
? null
: const Icon(Icons.chevron_right_outlined),
title: Text(
L10n.of(context)!.passwordRecovery,
style: TextStyle(
decoration:
error == null ? null : TextDecoration.lineThrough,
),
),
onTap: error != null
? null
: () => context.go('/rooms/settings/security/3pid'),
),
],
ListTile(
leading: const Icon(Icons.block_outlined),
trailing: const Icon(Icons.chevron_right_outlined),
title: Text(L10n.of(context)!.blockedUsers),
onTap: () =>
context.go('/rooms/settings/security/ignorelist'),
),
if (Matrix.of(context).client.encryption != null) ...{
if (PlatformInfos.isMobile)
ListTile(
leading: const Icon(Icons.lock_outlined),
trailing: const Icon(Icons.chevron_right_outlined),
title: Text(L10n.of(context)!.appLock),
onTap: controller.setAppLockAction,
),
},
const Divider(height: 1),
ListTile(
leading: const Icon(Icons.tap_and_play),
title: Text(
L10n.of(context)!.dehydrate,
style: const TextStyle(color: Colors.red),
L10n.of(context)!.privacy,
style: TextStyle(
color: Theme.of(context).colorScheme.secondary,
fontWeight: FontWeight.bold,
),
),
onTap: controller.dehydrateAction,
),
ListTile(
leading: const Icon(Icons.delete_outlined),
title: Text(
L10n.of(context)!.deleteAccount,
style: const TextStyle(color: Colors.red),
),
onTap: controller.deleteAccountAction,
),
ListTile(
title: Text(L10n.of(context)!.yourPublicKey),
subtitle: SelectableText(
Matrix.of(context).client.fingerprintKey.beautified,
style: const TextStyle(fontFamily: 'monospace'),
),
leading: const Icon(Icons.vpn_key_outlined),
),
const Divider(height: 1),
SettingsSwitchListTile.adaptive(
title: L10n.of(context)!.sendTypingNotifications,
subtitle:
@ -146,6 +66,95 @@ class SettingsSecurityView extends StatelessWidget {
storeKey: SettingKeys.sendPublicReadReceipts,
defaultValue: AppConfig.sendPublicReadReceipts,
),
ListTile(
trailing: const Icon(Icons.chevron_right_outlined),
title: Text(L10n.of(context)!.blockedUsers),
subtitle: Text(
L10n.of(context)!.thereAreCountUsersBlocked(
Matrix.of(context).client.ignoredUsers.length,
),
),
onTap: () =>
context.go('/rooms/settings/security/ignorelist'),
),
if (Matrix.of(context).client.encryption != null) ...{
if (PlatformInfos.isMobile)
ListTile(
leading: const Icon(Icons.lock_outlined),
trailing: const Icon(Icons.chevron_right_outlined),
title: Text(L10n.of(context)!.appLock),
onTap: controller.setAppLockAction,
),
},
Divider(
height: 1,
color: Theme.of(context).dividerColor,
),
ListTile(
title: Text(
L10n.of(context)!.account,
style: TextStyle(
color: Theme.of(context).colorScheme.secondary,
fontWeight: FontWeight.bold,
),
),
),
ListTile(
title: Text(L10n.of(context)!.yourPublicKey),
leading: const Icon(Icons.vpn_key_outlined),
subtitle: SelectableText(
Matrix.of(context).client.fingerprintKey.beautified,
style: const TextStyle(fontFamily: 'monospace'),
),
),
if (error != null)
ListTile(
leading: const Icon(
Icons.warning_outlined,
color: Colors.orange,
),
title: Text(
error.toLocalizedString(context),
style: const TextStyle(color: Colors.orange),
),
),
if (capabilities?.mChangePassword?.enabled != false ||
error != null)
ListTile(
leading: const Icon(Icons.password_outlined),
trailing: error != null
? null
: const Icon(Icons.chevron_right_outlined),
title: Text(
L10n.of(context)!.changePassword,
style: TextStyle(
decoration:
error == null ? null : TextDecoration.lineThrough,
),
),
onTap: error != null
? null
: () =>
context.go('/rooms/settings/security/password'),
),
ListTile(
iconColor: Colors.orange,
leading: const Icon(Icons.tap_and_play),
title: Text(
L10n.of(context)!.dehydrate,
style: const TextStyle(color: Colors.orange),
),
onTap: controller.dehydrateAction,
),
ListTile(
iconColor: Colors.red,
leading: const Icon(Icons.delete_outlined),
title: Text(
L10n.of(context)!.deleteAccount,
style: const TextStyle(color: Colors.red),
),
onTap: controller.deleteAccountAction,
),
],
);
},