2021-06-23 11:26:12 +02:00
|
|
|
import 'package:fluffychat/config/app_config.dart';
|
2021-10-10 12:57:28 +02:00
|
|
|
import 'package:fluffychat/utils/fluffy_share.dart';
|
2021-06-23 11:26:12 +02:00
|
|
|
import 'package:fluffychat/widgets/layouts/max_width_body.dart';
|
|
|
|
import 'package:fluffychat/widgets/matrix.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
|
|
|
import 'package:vrouter/vrouter.dart';
|
|
|
|
import 'package:matrix/matrix.dart';
|
|
|
|
|
|
|
|
import '../settings_account.dart';
|
|
|
|
|
|
|
|
class SettingsAccountView extends StatelessWidget {
|
|
|
|
final SettingsAccountController controller;
|
|
|
|
const SettingsAccountView(this.controller, {Key key}) : super(key: key);
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Scaffold(
|
|
|
|
appBar: AppBar(title: Text(L10n.of(context).account)),
|
|
|
|
body: MaxWidthBody(
|
|
|
|
withScrolling: true,
|
|
|
|
child: Column(
|
|
|
|
children: [
|
2021-10-10 12:57:28 +02:00
|
|
|
ListTile(
|
2021-10-14 18:09:30 +02:00
|
|
|
trailing: const Icon(Icons.add_box_outlined),
|
2021-10-14 16:57:01 +02:00
|
|
|
title: Text(L10n.of(context).addAccount),
|
|
|
|
subtitle: Text(L10n.of(context).enableMultiAccounts),
|
|
|
|
onTap: controller.addAccountAction,
|
|
|
|
),
|
2021-10-14 18:09:30 +02:00
|
|
|
const Divider(height: 1),
|
2021-10-14 16:57:01 +02:00
|
|
|
ListTile(
|
2021-10-10 12:57:28 +02:00
|
|
|
title: Text(L10n.of(context).yourUserId),
|
|
|
|
subtitle: Text(Matrix.of(context).client.userID),
|
2021-10-14 18:09:30 +02:00
|
|
|
trailing: const Icon(Icons.copy_outlined),
|
2021-10-10 12:57:28 +02:00
|
|
|
onTap: () => FluffyShare.share(
|
|
|
|
Matrix.of(context).client.userID,
|
|
|
|
context,
|
|
|
|
),
|
|
|
|
),
|
2021-06-23 11:26:12 +02:00
|
|
|
ListTile(
|
2021-10-14 18:09:30 +02:00
|
|
|
trailing: const Icon(Icons.edit_outlined),
|
2021-06-23 11:26:12 +02:00
|
|
|
title: Text(L10n.of(context).editDisplayname),
|
2021-08-18 17:24:59 +02:00
|
|
|
subtitle: Text(controller.profile?.displayName ??
|
2021-06-23 11:26:12 +02:00
|
|
|
Matrix.of(context).client.userID.localpart),
|
|
|
|
onTap: controller.setDisplaynameAction,
|
|
|
|
),
|
|
|
|
ListTile(
|
2021-10-14 18:09:30 +02:00
|
|
|
trailing: const Icon(Icons.phone_outlined),
|
2021-06-23 11:26:12 +02:00
|
|
|
title: Text(L10n.of(context).editJitsiInstance),
|
|
|
|
subtitle: Text(AppConfig.jitsiInstance),
|
|
|
|
onTap: controller.setJitsiInstanceAction,
|
|
|
|
),
|
|
|
|
ListTile(
|
2021-10-14 18:09:30 +02:00
|
|
|
trailing: const Icon(Icons.devices_other_outlined),
|
2021-06-23 11:26:12 +02:00
|
|
|
title: Text(L10n.of(context).devices),
|
2021-07-08 17:10:20 +02:00
|
|
|
onTap: () => VRouter.of(context).to('devices'),
|
2021-06-23 11:26:12 +02:00
|
|
|
),
|
2021-10-14 18:09:30 +02:00
|
|
|
const Divider(height: 1),
|
2021-06-23 11:26:12 +02:00
|
|
|
ListTile(
|
2021-10-14 18:09:30 +02:00
|
|
|
trailing: const Icon(Icons.exit_to_app_outlined),
|
2021-06-23 11:26:12 +02:00
|
|
|
title: Text(L10n.of(context).logout),
|
|
|
|
onTap: controller.logoutAction,
|
|
|
|
),
|
2021-10-14 18:09:30 +02:00
|
|
|
const Divider(height: 1),
|
2021-06-23 11:26:12 +02:00
|
|
|
ListTile(
|
2021-10-14 18:09:30 +02:00
|
|
|
trailing: const Icon(Icons.delete_forever_outlined),
|
2021-06-23 11:26:12 +02:00
|
|
|
title: Text(
|
|
|
|
L10n.of(context).deleteAccount,
|
2021-10-14 18:09:30 +02:00
|
|
|
style: const TextStyle(color: Colors.red),
|
2021-06-23 11:26:12 +02:00
|
|
|
),
|
|
|
|
onTap: controller.deleteAccountAction,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|