fluffychat/lib/pages/settings_security/settings_security_view.dart

75 lines
3.0 KiB
Dart
Raw Normal View History

2021-06-23 11:26:12 +02:00
import 'package:flutter/material.dart';
2021-10-26 18:50:34 +02:00
import 'package:adaptive_dialog/adaptive_dialog.dart';
2021-06-23 11:26:12 +02:00
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:vrouter/vrouter.dart';
import 'package:fluffychat/utils/beautify_string_extension.dart';
2021-10-26 18:50:34 +02:00
import 'package:fluffychat/utils/platform_infos.dart';
import 'package:fluffychat/widgets/layouts/max_width_body.dart';
import 'package:fluffychat/widgets/matrix.dart';
2021-11-09 21:32:16 +01:00
import 'settings_security.dart';
2021-06-23 11:26:12 +02:00
class SettingsSecurityView extends StatelessWidget {
final SettingsSecurityController controller;
const SettingsSecurityView(this.controller, {Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text(L10n.of(context).security)),
body: MaxWidthBody(
withScrolling: true,
child: Column(
children: [
ListTile(
2021-10-14 18:09:30 +02:00
trailing: const Icon(Icons.block_outlined),
2021-06-23 11:26:12 +02:00
title: Text(L10n.of(context).ignoredUsers),
2021-07-08 17:10:20 +02:00
onTap: () => VRouter.of(context).to('ignorelist'),
2021-06-23 11:26:12 +02:00
),
ListTile(
2021-10-14 18:09:30 +02:00
trailing: const Icon(Icons.security_outlined),
2021-06-23 11:26:12 +02:00
title: Text(
L10n.of(context).changePassword,
),
onTap: controller.changePasswordAccountAction,
),
ListTile(
2021-10-14 18:09:30 +02:00
trailing: const Icon(Icons.email_outlined),
2021-06-23 11:26:12 +02:00
title: Text(L10n.of(context).passwordRecovery),
2021-07-08 17:10:20 +02:00
onTap: () => VRouter.of(context).to('3pid'),
2021-06-23 11:26:12 +02:00
),
if (Matrix.of(context).client.encryption != null) ...{
2021-10-14 18:09:30 +02:00
const Divider(thickness: 1),
2021-06-23 11:26:12 +02:00
if (PlatformInfos.isMobile)
ListTile(
2021-10-14 18:09:30 +02:00
trailing: const Icon(Icons.lock_outlined),
2021-06-23 11:26:12 +02:00
title: Text(L10n.of(context).appLock),
onTap: controller.setAppLockAction,
),
ListTile(
title: Text(L10n.of(context).yourPublicKey),
onTap: () => showOkAlertDialog(
useRootNavigator: false,
context: context,
title: L10n.of(context).yourPublicKey,
message: Matrix.of(context).client.fingerprintKey.beautified,
okLabel: L10n.of(context).ok,
),
2021-10-14 18:09:30 +02:00
trailing: const Icon(Icons.vpn_key_outlined),
2021-06-23 11:26:12 +02:00
),
ListTile(
title: Text(L10n.of(context).cachedKeys),
2021-10-14 18:09:30 +02:00
trailing: const Icon(Icons.wb_cloudy_outlined),
2021-06-23 11:26:12 +02:00
subtitle: Text(
'${Matrix.of(context).client.encryption.keyManager.enabled ? L10n.of(context).onlineKeyBackupEnabled : L10n.of(context).onlineKeyBackupDisabled}\n${Matrix.of(context).client.encryption.crossSigning.enabled ? L10n.of(context).crossSigningEnabled : L10n.of(context).crossSigningDisabled}'),
onTap: controller.bootstrapSettingsAction,
),
},
],
),
),
);
}
}