2021-10-26 16:50:34 +00:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
2023-08-02 10:08:23 +00:00
|
|
|
import 'package:go_router/go_router.dart';
|
2021-10-26 16:50:34 +00:00
|
|
|
|
2021-06-23 09:26:12 +00:00
|
|
|
import 'package:fluffychat/config/app_config.dart';
|
|
|
|
import 'package:fluffychat/config/setting_keys.dart';
|
2021-08-24 18:43:21 +00:00
|
|
|
import 'package:fluffychat/utils/platform_infos.dart';
|
2022-09-10 10:12:52 +00:00
|
|
|
import 'package:fluffychat/utils/voip/callkeep_manager.dart';
|
2021-06-23 09:26:12 +00:00
|
|
|
import 'package:fluffychat/widgets/layouts/max_width_body.dart';
|
2022-02-19 10:58:21 +00:00
|
|
|
import 'package:fluffychat/widgets/matrix.dart';
|
2021-06-23 09:26:12 +00:00
|
|
|
import 'package:fluffychat/widgets/settings_switch_list_tile.dart';
|
2021-11-09 20:32:16 +00:00
|
|
|
import 'settings_chat.dart';
|
2021-06-23 09:26:12 +00:00
|
|
|
|
|
|
|
class SettingsChatView extends StatelessWidget {
|
|
|
|
final SettingsChatController controller;
|
2023-10-28 11:03:16 +00:00
|
|
|
const SettingsChatView(this.controller, {super.key});
|
2021-06-23 09:26:12 +00:00
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2024-08-04 12:09:36 +00:00
|
|
|
final theme = Theme.of(context);
|
|
|
|
|
2021-06-23 09:26:12 +00:00
|
|
|
return Scaffold(
|
2024-10-06 06:35:37 +00:00
|
|
|
appBar: AppBar(title: Text(L10n.of(context).chat)),
|
2021-11-14 12:24:01 +00:00
|
|
|
body: ListTileTheme(
|
2024-08-04 12:09:36 +00:00
|
|
|
iconColor: theme.textTheme.bodyLarge!.color,
|
2021-11-14 12:24:01 +00:00
|
|
|
child: MaxWidthBody(
|
|
|
|
child: Column(
|
|
|
|
children: [
|
2021-11-27 09:10:29 +00:00
|
|
|
SettingsSwitchListTile.adaptive(
|
2024-10-06 06:35:37 +00:00
|
|
|
title: L10n.of(context).formattedMessages,
|
|
|
|
subtitle: L10n.of(context).formattedMessagesDescription,
|
2021-11-14 12:24:01 +00:00
|
|
|
onChanged: (b) => AppConfig.renderHtml = b,
|
|
|
|
storeKey: SettingKeys.renderHtml,
|
|
|
|
defaultValue: AppConfig.renderHtml,
|
2021-08-24 18:43:21 +00:00
|
|
|
),
|
2021-11-27 09:10:29 +00:00
|
|
|
SettingsSwitchListTile.adaptive(
|
2024-10-06 06:35:37 +00:00
|
|
|
title: L10n.of(context).hideMemberChangesInPublicChats,
|
|
|
|
subtitle: L10n.of(context).hideMemberChangesInPublicChatsBody,
|
2024-04-14 10:00:43 +00:00
|
|
|
onChanged: (b) => AppConfig.hideUnimportantStateEvents = b,
|
|
|
|
storeKey: SettingKeys.hideUnimportantStateEvents,
|
|
|
|
defaultValue: AppConfig.hideUnimportantStateEvents,
|
|
|
|
),
|
|
|
|
SettingsSwitchListTile.adaptive(
|
2024-10-06 06:35:37 +00:00
|
|
|
title: L10n.of(context).hideRedactedMessages,
|
|
|
|
subtitle: L10n.of(context).hideRedactedMessagesBody,
|
2021-11-14 12:24:01 +00:00
|
|
|
onChanged: (b) => AppConfig.hideRedactedEvents = b,
|
|
|
|
storeKey: SettingKeys.hideRedactedEvents,
|
|
|
|
defaultValue: AppConfig.hideRedactedEvents,
|
|
|
|
),
|
2021-11-27 09:10:29 +00:00
|
|
|
SettingsSwitchListTile.adaptive(
|
2024-10-06 06:35:37 +00:00
|
|
|
title: L10n.of(context).hideInvalidOrUnknownMessageFormats,
|
2021-11-14 12:24:01 +00:00
|
|
|
onChanged: (b) => AppConfig.hideUnknownEvents = b,
|
|
|
|
storeKey: SettingKeys.hideUnknownEvents,
|
|
|
|
defaultValue: AppConfig.hideUnknownEvents,
|
|
|
|
),
|
|
|
|
if (PlatformInfos.isMobile)
|
2021-11-27 09:10:29 +00:00
|
|
|
SettingsSwitchListTile.adaptive(
|
2024-10-06 06:35:37 +00:00
|
|
|
title: L10n.of(context).autoplayImages,
|
2022-02-19 10:58:21 +00:00
|
|
|
onChanged: (b) => AppConfig.autoplayImages = b,
|
|
|
|
storeKey: SettingKeys.autoplayImages,
|
|
|
|
defaultValue: AppConfig.autoplayImages,
|
|
|
|
),
|
2022-03-20 16:38:13 +00:00
|
|
|
SettingsSwitchListTile.adaptive(
|
2024-10-06 06:35:37 +00:00
|
|
|
title: L10n.of(context).sendOnEnter,
|
2022-03-20 16:38:13 +00:00
|
|
|
onChanged: (b) => AppConfig.sendOnEnter = b,
|
|
|
|
storeKey: SettingKeys.sendOnEnter,
|
2023-12-23 08:17:31 +00:00
|
|
|
defaultValue: AppConfig.sendOnEnter ?? !PlatformInfos.isMobile,
|
2022-03-20 16:38:13 +00:00
|
|
|
),
|
2024-06-03 22:31:37 +00:00
|
|
|
SettingsSwitchListTile.adaptive(
|
2024-10-06 06:35:37 +00:00
|
|
|
title: L10n.of(context).swipeRightToLeftToReply,
|
2024-06-03 22:31:37 +00:00
|
|
|
onChanged: (b) => AppConfig.swipeRightToLeftToReply = b,
|
|
|
|
storeKey: SettingKeys.swipeRightToLeftToReply,
|
|
|
|
defaultValue: AppConfig.swipeRightToLeftToReply,
|
|
|
|
),
|
2024-08-04 12:09:36 +00:00
|
|
|
Divider(color: theme.dividerColor),
|
2024-04-14 11:06:30 +00:00
|
|
|
ListTile(
|
|
|
|
title: Text(
|
2024-10-06 06:35:37 +00:00
|
|
|
L10n.of(context).customEmojisAndStickers,
|
2024-04-14 11:06:30 +00:00
|
|
|
style: TextStyle(
|
2024-08-04 12:09:36 +00:00
|
|
|
color: theme.colorScheme.secondary,
|
2024-04-14 11:06:30 +00:00
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
2024-04-14 10:39:37 +00:00
|
|
|
ListTile(
|
2024-10-06 06:35:37 +00:00
|
|
|
title: Text(L10n.of(context).customEmojisAndStickers),
|
|
|
|
subtitle: Text(L10n.of(context).customEmojisAndStickersBody),
|
2024-04-14 10:39:37 +00:00
|
|
|
onTap: () => context.go('/rooms/settings/chat/emotes'),
|
|
|
|
trailing: const Padding(
|
|
|
|
padding: EdgeInsets.all(16.0),
|
2024-04-14 11:06:30 +00:00
|
|
|
child: Icon(Icons.chevron_right_outlined),
|
2024-04-14 10:39:37 +00:00
|
|
|
),
|
|
|
|
),
|
2024-08-04 12:09:36 +00:00
|
|
|
Divider(color: theme.dividerColor),
|
2024-04-14 11:06:30 +00:00
|
|
|
ListTile(
|
|
|
|
title: Text(
|
2024-10-06 06:35:37 +00:00
|
|
|
L10n.of(context).calls,
|
2024-04-14 11:06:30 +00:00
|
|
|
style: TextStyle(
|
2024-08-04 12:09:36 +00:00
|
|
|
color: theme.colorScheme.secondary,
|
2024-04-14 11:06:30 +00:00
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
2023-08-13 16:21:55 +00:00
|
|
|
SettingsSwitchListTile.adaptive(
|
2024-10-06 06:35:37 +00:00
|
|
|
title: L10n.of(context).experimentalVideoCalls,
|
2023-08-13 16:21:55 +00:00
|
|
|
onChanged: (b) {
|
|
|
|
AppConfig.experimentalVoip = b;
|
|
|
|
Matrix.of(context).createVoipPlugin();
|
|
|
|
return;
|
|
|
|
},
|
|
|
|
storeKey: SettingKeys.experimentalVoip,
|
|
|
|
defaultValue: AppConfig.experimentalVoip,
|
|
|
|
),
|
|
|
|
if (PlatformInfos.isMobile)
|
2022-09-10 10:12:52 +00:00
|
|
|
ListTile(
|
2024-10-06 06:35:37 +00:00
|
|
|
title: Text(L10n.of(context).callingPermissions),
|
2022-09-10 10:12:52 +00:00
|
|
|
onTap: () =>
|
|
|
|
CallKeepManager().checkoutPhoneAccountSetting(context),
|
|
|
|
trailing: const Padding(
|
|
|
|
padding: EdgeInsets.all(16.0),
|
|
|
|
child: Icon(Icons.call),
|
|
|
|
),
|
|
|
|
),
|
2021-11-14 12:24:01 +00:00
|
|
|
],
|
|
|
|
),
|
2021-06-23 09:26:12 +00:00
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|