From 5b648624dae097755bd69ea0563a8e52e4b3c188 Mon Sep 17 00:00:00 2001 From: krille-chan Date: Fri, 26 Jul 2024 21:25:45 +0200 Subject: [PATCH] chore: Chat permissions page follow up --- assets/l10n/intl_en.arb | 3 ++- .../chat_permissions_settings_view.dart | 16 ++++++++++++++ .../permission_list_tile.dart | 22 ++++++++++++------- 3 files changed, 32 insertions(+), 9 deletions(-) diff --git a/assets/l10n/intl_en.arb b/assets/l10n/intl_en.arb index f7016107b..7132187c1 100644 --- a/assets/l10n/intl_en.arb +++ b/assets/l10n/intl_en.arb @@ -2739,5 +2739,6 @@ "changeTheVisibilityOfChatHistory": "Change the visibility of the chat history", "changeTheCanonicalRoomAlias": "Change the main public chat address", "sendRoomNotifications": "Send a @room notifications", - "changeTheDescriptionOfTheGroup": "Change the description of the chat" + "changeTheDescriptionOfTheGroup": "Change the description of the chat", + "chatPermissionsDescription": "Define which power level is necessary for certain actions in this chat. The power levels 0, 50 and 100 are usually representing users, moderators and admins, but any gradation is possible." } diff --git a/lib/pages/chat_permissions_settings/chat_permissions_settings_view.dart b/lib/pages/chat_permissions_settings/chat_permissions_settings_view.dart index 50d46c08e..610f6b0e8 100644 --- a/lib/pages/chat_permissions_settings/chat_permissions_settings_view.dart +++ b/lib/pages/chat_permissions_settings/chat_permissions_settings_view.dart @@ -41,6 +41,22 @@ class ChatPermissionsSettingsView extends StatelessWidget { )..removeWhere((k, v) => v is! int); return Column( children: [ + ListTile( + leading: const Icon(Icons.info_outlined), + subtitle: Text( + L10n.of(context)!.chatPermissionsDescription, + ), + ), + Divider(color: Theme.of(context).dividerColor), + ListTile( + title: Text( + L10n.of(context)!.chatPermissions, + style: TextStyle( + color: Theme.of(context).colorScheme.primary, + fontWeight: FontWeight.bold, + ), + ), + ), Column( mainAxisSize: MainAxisSize.min, children: [ diff --git a/lib/pages/chat_permissions_settings/permission_list_tile.dart b/lib/pages/chat_permissions_settings/permission_list_tile.dart index 99f9e553b..118982d37 100644 --- a/lib/pages/chat_permissions_settings/permission_list_tile.dart +++ b/lib/pages/chat_permissions_settings/permission_list_tile.dart @@ -82,11 +82,8 @@ class PermissionsListTile extends StatelessWidget { style: Theme.of(context).textTheme.titleSmall, ), trailing: Material( - color: color.withAlpha(64), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(AppConfig.borderRadius / 2), - side: BorderSide(color: color), - ), + color: color.withAlpha(32), + borderRadius: BorderRadius.circular(AppConfig.borderRadius / 2), child: DropdownButton( padding: const EdgeInsets.symmetric(horizontal: 8.0), borderRadius: BorderRadius.circular(AppConfig.borderRadius / 2), @@ -96,15 +93,24 @@ class PermissionsListTile extends StatelessWidget { items: [ DropdownMenuItem( value: permission < 50 ? permission : 0, - child: Text(L10n.of(context)!.userLevel(permission)), + child: Text( + L10n.of(context)!.userLevel(permission < 50 ? permission : 0), + ), ), DropdownMenuItem( value: permission < 100 && permission >= 50 ? permission : 50, - child: Text(L10n.of(context)!.moderatorLevel(permission)), + child: Text( + L10n.of(context)!.moderatorLevel( + permission < 100 && permission >= 50 ? permission : 50, + ), + ), ), DropdownMenuItem( value: permission >= 100 ? permission : 100, - child: Text(L10n.of(context)!.adminLevel(permission)), + child: Text( + L10n.of(context)! + .adminLevel(permission >= 100 ? permission : 100), + ), ), DropdownMenuItem( value: null,