fluffychat/lib/pages/settings_security/settings_security_view.dart

96 lines
3.7 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
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;
2022-01-29 12:35:03 +01:00
const SettingsSecurityView(this.controller, {Key? key}) : super(key: key);
2021-06-23 11:26:12 +02:00
@override
Widget build(BuildContext context) {
return Scaffold(
2022-01-29 12:35:03 +01:00
appBar: AppBar(title: Text(L10n.of(context)!.security)),
2021-11-14 13:24:01 +01:00
body: ListTileTheme(
2023-02-04 18:32:56 +01:00
iconColor: Theme.of(context).colorScheme.onBackground,
2021-11-14 13:24:01 +01:00
child: MaxWidthBody(
withScrolling: true,
child: Column(
children: [
2021-12-25 10:20:18 +01:00
ListTile(
leading: const Icon(Icons.camera_outlined),
2023-02-04 18:32:56 +01:00
trailing: const Icon(Icons.chevron_right_outlined),
2022-01-29 12:35:03 +01:00
title: Text(L10n.of(context)!.whoCanSeeMyStories),
2021-12-25 10:20:18 +01:00
onTap: () => VRouter.of(context).to('stories'),
),
2021-06-23 11:26:12 +02:00
ListTile(
leading: const Icon(Icons.block_outlined),
2023-02-04 18:32:56 +01:00
trailing: const Icon(Icons.chevron_right_outlined),
2022-01-29 12:35:03 +01:00
title: Text(L10n.of(context)!.ignoredUsers),
2021-11-14 13:24:01 +01:00
onTap: () => VRouter.of(context).to('ignorelist'),
2021-11-11 19:39:55 +01:00
),
ListTile(
2023-02-04 18:32:56 +01:00
leading: const Icon(Icons.password_outlined),
trailing: const Icon(Icons.chevron_right_outlined),
2021-11-14 13:24:01 +01:00
title: Text(
2022-01-29 12:35:03 +01:00
L10n.of(context)!.changePassword,
2021-11-14 13:24:01 +01:00
),
onTap: controller.changePasswordAccountAction,
2021-11-11 19:39:55 +01:00
),
ListTile(
2023-02-04 18:32:56 +01:00
leading: const Icon(Icons.mail_outlined),
trailing: const Icon(Icons.chevron_right_outlined),
2022-01-29 12:35:03 +01:00
title: Text(L10n.of(context)!.passwordRecovery),
2021-11-14 13:24:01 +01:00
onTap: () => VRouter.of(context).to('3pid'),
2021-11-11 19:39:55 +01:00
),
2021-11-14 13:24:01 +01:00
if (Matrix.of(context).client.encryption != null) ...{
const Divider(thickness: 1),
if (PlatformInfos.isMobile)
ListTile(
2023-02-04 18:32:56 +01:00
leading: const Icon(Icons.lock_outlined),
trailing: const Icon(Icons.chevron_right_outlined),
2022-01-29 12:35:03 +01:00
title: Text(L10n.of(context)!.appLock),
2021-11-14 13:24:01 +01:00
onTap: controller.setAppLockAction,
),
ListTile(
2022-01-29 12:35:03 +01:00
title: Text(L10n.of(context)!.yourPublicKey),
2023-02-04 18:32:56 +01:00
subtitle: Text(
Matrix.of(context).client.fingerprintKey.beautified,
style: const TextStyle(fontFamily: 'monospace'),
2021-12-25 10:20:18 +01:00
),
2023-02-04 18:32:56 +01:00
leading: const Icon(Icons.vpn_key_outlined),
2021-11-14 13:24:01 +01:00
),
},
2023-02-04 18:32:56 +01:00
const Divider(height: 1),
ListTile(
leading: const Icon(Icons.tap_and_play),
trailing: const Icon(Icons.chevron_right_outlined),
title: Text(
L10n.of(context)!.dehydrate,
style: const TextStyle(color: Colors.red),
),
onTap: controller.dehydrateAction,
),
ListTile(
leading: const Icon(Icons.delete_outlined),
trailing: const Icon(Icons.chevron_right_outlined),
title: Text(
L10n.of(context)!.deleteAccount,
style: const TextStyle(color: Colors.red),
),
onTap: controller.deleteAccountAction,
),
2021-11-14 13:24:01 +01:00
],
),
2021-06-23 11:26:12 +02:00
),
),
);
}
}