design: Adjust chat settings design

This commit is contained in:
krille-chan 2024-04-14 12:00:43 +02:00
commit e43a4ad65f
No known key found for this signature in database
3 changed files with 23 additions and 23 deletions

View file

@ -31,7 +31,10 @@ class SettingsChatView extends StatelessWidget {
trailing: const Icon(Icons.chevron_right_outlined),
leading: const Icon(Icons.emoji_emotions_outlined),
),
const Divider(),
Divider(
height: 1,
color: Theme.of(context).dividerColor,
),
SettingsSwitchListTile.adaptive(
title: L10n.of(context)!.formattedMessages,
subtitle: L10n.of(context)!.formattedMessagesDescription,
@ -40,23 +43,25 @@ class SettingsChatView extends StatelessWidget {
defaultValue: AppConfig.renderHtml,
),
SettingsSwitchListTile.adaptive(
title: L10n.of(context)!.hideRedactedEvents,
title: L10n.of(context)!.hideMemberChangesInPublicChats,
subtitle: L10n.of(context)!.hideMemberChangesInPublicChatsBody,
onChanged: (b) => AppConfig.hideUnimportantStateEvents = b,
storeKey: SettingKeys.hideUnimportantStateEvents,
defaultValue: AppConfig.hideUnimportantStateEvents,
),
SettingsSwitchListTile.adaptive(
title: L10n.of(context)!.hideRedactedMessages,
subtitle: L10n.of(context)!.hideRedactedMessagesBody,
onChanged: (b) => AppConfig.hideRedactedEvents = b,
storeKey: SettingKeys.hideRedactedEvents,
defaultValue: AppConfig.hideRedactedEvents,
),
SettingsSwitchListTile.adaptive(
title: L10n.of(context)!.hideUnknownEvents,
title: L10n.of(context)!.hideInvalidOrUnknownMessageFormats,
onChanged: (b) => AppConfig.hideUnknownEvents = b,
storeKey: SettingKeys.hideUnknownEvents,
defaultValue: AppConfig.hideUnknownEvents,
),
SettingsSwitchListTile.adaptive(
title: L10n.of(context)!.hideUnimportantStateEvents,
onChanged: (b) => AppConfig.hideUnimportantStateEvents = b,
storeKey: SettingKeys.hideUnimportantStateEvents,
defaultValue: AppConfig.hideUnimportantStateEvents,
),
if (PlatformInfos.isMobile)
SettingsSwitchListTile.adaptive(
title: L10n.of(context)!.autoplayImages,
@ -64,7 +69,10 @@ class SettingsChatView extends StatelessWidget {
storeKey: SettingKeys.autoplayImages,
defaultValue: AppConfig.autoplayImages,
),
const Divider(),
Divider(
height: 1,
color: Theme.of(context).dividerColor,
),
SettingsSwitchListTile.adaptive(
title: L10n.of(context)!.sendOnEnter,
onChanged: (b) => AppConfig.sendOnEnter = b,

View file

@ -18,10 +18,6 @@ extension IsStateExtension on Event {
(!AppConfig.hideUnknownEvents || isEventTypeKnown) &&
// remove state events that we don't want to render
(isState || !AppConfig.hideAllStateEvents) &&
// hide unimportant state events
(!AppConfig.hideUnimportantStateEvents ||
!isState ||
importantStateEvents.contains(type)) &&
// hide simple join/leave member events in public rooms
(!AppConfig.hideUnimportantStateEvents ||
type != EventTypes.RoomMember ||
@ -29,14 +25,6 @@ extension IsStateExtension on Event {
content.tryGet<String>('membership') == 'ban' ||
stateKey != senderId);
static const Set<String> importantStateEvents = {
EventTypes.Encryption,
EventTypes.RoomCreate,
EventTypes.RoomMember,
EventTypes.RoomTombstone,
EventTypes.CallInvite,
};
bool get isState => !{
EventTypes.Message,
EventTypes.Sticker,