mirror of
https://github.com/krille-chan/fluffychat
synced 2024-09-10 01:05:17 +00:00
chore: Resort settings and add more description text
This commit is contained in:
parent
a7a8285a55
commit
f7c89ddf9e
4 changed files with 31 additions and 21 deletions
|
@ -1529,11 +1529,6 @@
|
||||||
"type": "text",
|
"type": "text",
|
||||||
"placeholders": {}
|
"placeholders": {}
|
||||||
},
|
},
|
||||||
"renderRichContent": "Render rich message content",
|
|
||||||
"@renderRichContent": {
|
|
||||||
"type": "text",
|
|
||||||
"placeholders": {}
|
|
||||||
},
|
|
||||||
"replaceRoomWithNewerVersion": "Replace room with newer version",
|
"replaceRoomWithNewerVersion": "Replace room with newer version",
|
||||||
"@replaceRoomWithNewerVersion": {
|
"@replaceRoomWithNewerVersion": {
|
||||||
"type": "text",
|
"type": "text",
|
||||||
|
@ -2417,5 +2412,10 @@
|
||||||
"roomName": {}
|
"roomName": {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"sendReadReceipts": "Send read receipts"
|
"sendReadReceipts": "Send read receipts",
|
||||||
|
"sendTypingNotificationsDescription": "Other participants in a chat can see when you are typing a new message.",
|
||||||
|
"sendReadReceiptsDescription": "Andere Teilnehmer in einem Chat können sehen, ob du eine Nachricht gelesen hast.",
|
||||||
|
"formattedMessages": "Formatted messages",
|
||||||
|
"formattedMessagesDescription": "Display rich message content like bold text using markdown."
|
||||||
|
|
||||||
}
|
}
|
|
@ -33,7 +33,8 @@ class SettingsChatView extends StatelessWidget {
|
||||||
),
|
),
|
||||||
const Divider(),
|
const Divider(),
|
||||||
SettingsSwitchListTile.adaptive(
|
SettingsSwitchListTile.adaptive(
|
||||||
title: L10n.of(context)!.renderRichContent,
|
title: L10n.of(context)!.formattedMessages,
|
||||||
|
subtitle: L10n.of(context)!.formattedMessagesDescription,
|
||||||
onChanged: (b) => AppConfig.renderHtml = b,
|
onChanged: (b) => AppConfig.renderHtml = b,
|
||||||
storeKey: SettingKeys.renderHtml,
|
storeKey: SettingKeys.renderHtml,
|
||||||
defaultValue: AppConfig.renderHtml,
|
defaultValue: AppConfig.renderHtml,
|
||||||
|
@ -64,18 +65,6 @@ class SettingsChatView extends StatelessWidget {
|
||||||
defaultValue: AppConfig.autoplayImages,
|
defaultValue: AppConfig.autoplayImages,
|
||||||
),
|
),
|
||||||
const Divider(),
|
const Divider(),
|
||||||
SettingsSwitchListTile.adaptive(
|
|
||||||
title: L10n.of(context)!.sendTypingNotifications,
|
|
||||||
onChanged: (b) => AppConfig.sendTypingNotifications = b,
|
|
||||||
storeKey: SettingKeys.sendTypingNotifications,
|
|
||||||
defaultValue: AppConfig.sendTypingNotifications,
|
|
||||||
),
|
|
||||||
SettingsSwitchListTile.adaptive(
|
|
||||||
title: L10n.of(context)!.sendReadReceipts,
|
|
||||||
onChanged: (b) => AppConfig.sendPublicReadReceipts = b,
|
|
||||||
storeKey: SettingKeys.sendPublicReadReceipts,
|
|
||||||
defaultValue: AppConfig.sendPublicReadReceipts,
|
|
||||||
),
|
|
||||||
SettingsSwitchListTile.adaptive(
|
SettingsSwitchListTile.adaptive(
|
||||||
title: L10n.of(context)!.sendOnEnter,
|
title: L10n.of(context)!.sendOnEnter,
|
||||||
onChanged: (b) => AppConfig.sendOnEnter = b,
|
onChanged: (b) => AppConfig.sendOnEnter = b,
|
||||||
|
|
|
@ -3,11 +3,14 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
|
|
||||||
|
import 'package:fluffychat/config/app_config.dart';
|
||||||
|
import 'package:fluffychat/config/setting_keys.dart';
|
||||||
import 'package:fluffychat/utils/beautify_string_extension.dart';
|
import 'package:fluffychat/utils/beautify_string_extension.dart';
|
||||||
import 'package:fluffychat/utils/localized_exception_extension.dart';
|
import 'package:fluffychat/utils/localized_exception_extension.dart';
|
||||||
import 'package:fluffychat/utils/platform_infos.dart';
|
import 'package:fluffychat/utils/platform_infos.dart';
|
||||||
import 'package:fluffychat/widgets/layouts/max_width_body.dart';
|
import 'package:fluffychat/widgets/layouts/max_width_body.dart';
|
||||||
import 'package:fluffychat/widgets/matrix.dart';
|
import 'package:fluffychat/widgets/matrix.dart';
|
||||||
|
import 'package:fluffychat/widgets/settings_switch_list_tile.dart';
|
||||||
import 'settings_security.dart';
|
import 'settings_security.dart';
|
||||||
|
|
||||||
class SettingsSecurityView extends StatelessWidget {
|
class SettingsSecurityView extends StatelessWidget {
|
||||||
|
@ -105,7 +108,6 @@ class SettingsSecurityView extends StatelessWidget {
|
||||||
const Divider(height: 1),
|
const Divider(height: 1),
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: const Icon(Icons.tap_and_play),
|
leading: const Icon(Icons.tap_and_play),
|
||||||
trailing: const Icon(Icons.chevron_right_outlined),
|
|
||||||
title: Text(
|
title: Text(
|
||||||
L10n.of(context)!.dehydrate,
|
L10n.of(context)!.dehydrate,
|
||||||
style: const TextStyle(color: Colors.red),
|
style: const TextStyle(color: Colors.red),
|
||||||
|
@ -114,7 +116,6 @@ class SettingsSecurityView extends StatelessWidget {
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: const Icon(Icons.delete_outlined),
|
leading: const Icon(Icons.delete_outlined),
|
||||||
trailing: const Icon(Icons.chevron_right_outlined),
|
|
||||||
title: Text(
|
title: Text(
|
||||||
L10n.of(context)!.deleteAccount,
|
L10n.of(context)!.deleteAccount,
|
||||||
style: const TextStyle(color: Colors.red),
|
style: const TextStyle(color: Colors.red),
|
||||||
|
@ -129,6 +130,22 @@ class SettingsSecurityView extends StatelessWidget {
|
||||||
),
|
),
|
||||||
leading: const Icon(Icons.vpn_key_outlined),
|
leading: const Icon(Icons.vpn_key_outlined),
|
||||||
),
|
),
|
||||||
|
const Divider(height: 1),
|
||||||
|
SettingsSwitchListTile.adaptive(
|
||||||
|
title: L10n.of(context)!.sendTypingNotifications,
|
||||||
|
subtitle:
|
||||||
|
L10n.of(context)!.sendTypingNotificationsDescription,
|
||||||
|
onChanged: (b) => AppConfig.sendTypingNotifications = b,
|
||||||
|
storeKey: SettingKeys.sendTypingNotifications,
|
||||||
|
defaultValue: AppConfig.sendTypingNotifications,
|
||||||
|
),
|
||||||
|
SettingsSwitchListTile.adaptive(
|
||||||
|
title: L10n.of(context)!.sendReadReceipts,
|
||||||
|
subtitle: L10n.of(context)!.sendReadReceiptsDescription,
|
||||||
|
onChanged: (b) => AppConfig.sendPublicReadReceipts = b,
|
||||||
|
storeKey: SettingKeys.sendPublicReadReceipts,
|
||||||
|
defaultValue: AppConfig.sendPublicReadReceipts,
|
||||||
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
|
@ -6,6 +6,7 @@ class SettingsSwitchListTile extends StatefulWidget {
|
||||||
final bool defaultValue;
|
final bool defaultValue;
|
||||||
final String storeKey;
|
final String storeKey;
|
||||||
final String title;
|
final String title;
|
||||||
|
final String? subtitle;
|
||||||
final Function(bool)? onChanged;
|
final Function(bool)? onChanged;
|
||||||
|
|
||||||
const SettingsSwitchListTile.adaptive({
|
const SettingsSwitchListTile.adaptive({
|
||||||
|
@ -13,6 +14,7 @@ class SettingsSwitchListTile extends StatefulWidget {
|
||||||
this.defaultValue = false,
|
this.defaultValue = false,
|
||||||
required this.storeKey,
|
required this.storeKey,
|
||||||
required this.title,
|
required this.title,
|
||||||
|
this.subtitle,
|
||||||
this.onChanged,
|
this.onChanged,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -23,10 +25,12 @@ class SettingsSwitchListTile extends StatefulWidget {
|
||||||
class SettingsSwitchListTileState extends State<SettingsSwitchListTile> {
|
class SettingsSwitchListTileState extends State<SettingsSwitchListTile> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
final subtitle = widget.subtitle;
|
||||||
return SwitchListTile.adaptive(
|
return SwitchListTile.adaptive(
|
||||||
value: Matrix.of(context).store.getBool(widget.storeKey) ??
|
value: Matrix.of(context).store.getBool(widget.storeKey) ??
|
||||||
widget.defaultValue,
|
widget.defaultValue,
|
||||||
title: Text(widget.title),
|
title: Text(widget.title),
|
||||||
|
subtitle: subtitle == null ? null : Text(subtitle),
|
||||||
onChanged: (bool newValue) async {
|
onChanged: (bool newValue) async {
|
||||||
widget.onChanged?.call(newValue);
|
widget.onChanged?.call(newValue);
|
||||||
await Matrix.of(context).store.setBool(widget.storeKey, newValue);
|
await Matrix.of(context).store.setBool(widget.storeKey, newValue);
|
||||||
|
|
Loading…
Reference in a new issue