fluffychat/lib/pages/settings_account/settings_account_view.dart

77 lines
2.8 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:matrix/matrix.dart';
2021-10-26 18:50:34 +02:00
import 'package:fluffychat/utils/fluffy_share.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_account.dart';
2021-06-23 11:26:12 +02:00
class SettingsAccountView extends StatelessWidget {
final SettingsAccountController controller;
2022-01-29 12:35:03 +01:00
const SettingsAccountView(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)!.account)),
2021-11-14 13:24:01 +01:00
body: ListTileTheme(
2022-01-29 12:35:03 +01:00
iconColor: Theme.of(context).textTheme.bodyText1!.color,
2021-11-14 13:24:01 +01:00
child: MaxWidthBody(
withScrolling: true,
child: Column(
children: [
ListTile(
2022-01-29 12:35:03 +01:00
title: Text(L10n.of(context)!.yourUserId),
subtitle: Text(Matrix.of(context).client.userID!),
2021-11-14 13:24:01 +01:00
trailing: const Icon(Icons.copy_outlined),
onTap: () => FluffyShare.share(
2022-01-29 12:35:03 +01:00
Matrix.of(context).client.userID!,
2021-11-14 13:24:01 +01:00
context,
),
),
2021-11-14 13:24:01 +01:00
ListTile(
trailing: const Icon(Icons.edit_outlined),
2022-01-29 12:35:03 +01:00
title: Text(L10n.of(context)!.editDisplayname),
2021-11-14 13:24:01 +01:00
subtitle: Text(controller.profile?.displayName ??
2022-01-29 12:35:03 +01:00
Matrix.of(context).client.userID!.localpart!),
2021-11-14 13:24:01 +01:00
onTap: controller.setDisplaynameAction,
2021-06-23 11:26:12 +02:00
),
2021-11-14 13:24:01 +01:00
const Divider(height: 1),
ListTile(
trailing: const Icon(Icons.person_add_outlined),
2022-01-29 12:35:03 +01:00
title: Text(L10n.of(context)!.addAccount),
subtitle: Text(L10n.of(context)!.enableMultiAccounts),
2021-11-14 13:24:01 +01:00
onTap: controller.addAccountAction,
),
ListTile(
trailing: const Icon(Icons.exit_to_app_outlined),
2022-01-29 12:35:03 +01:00
title: Text(L10n.of(context)!.logout),
2021-11-14 13:24:01 +01:00
onTap: controller.logoutAction,
),
const Divider(height: 1),
ListTile(
trailing: const Icon(Icons.tap_and_play),
title: Text(
L10n.of(context)!.dehydrate,
style: const TextStyle(color: Colors.red),
),
onTap: controller.dehydrateAction,
),
2021-11-14 13:24:01 +01:00
ListTile(
trailing: const Icon(Icons.delete_outlined),
title: Text(
2022-01-29 12:35:03 +01:00
L10n.of(context)!.deleteAccount,
2021-11-14 13:24:01 +01:00
style: const TextStyle(color: Colors.red),
),
onTap: controller.deleteAccountAction,
),
],
),
2021-06-23 11:26:12 +02:00
),
),
);
}
}