Refactor: Reduce .of(context) calls theme

Signed commit
This commit is contained in:
Thomas Klein Langenhorst 2024-08-04 14:09:36 +02:00
commit 5d2aaef3ca
No known key found for this signature in database
GPG key ID: CA868C3CB279DA5B
69 changed files with 525 additions and 501 deletions

View file

@ -15,6 +15,8 @@ class ChatPermissionsSettingsView extends StatelessWidget {
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
return Scaffold(
appBar: AppBar(
leading: const Center(child: BackButton()),
@ -47,12 +49,12 @@ class ChatPermissionsSettingsView extends StatelessWidget {
L10n.of(context)!.chatPermissionsDescription,
),
),
Divider(color: Theme.of(context).dividerColor),
Divider(color: theme.dividerColor),
ListTile(
title: Text(
L10n.of(context)!.chatPermissions,
style: TextStyle(
color: Theme.of(context).colorScheme.primary,
color: theme.colorScheme.primary,
fontWeight: FontWeight.bold,
),
),
@ -72,12 +74,12 @@ class ChatPermissionsSettingsView extends StatelessWidget {
),
canEdit: room.canChangePowerLevel,
),
Divider(color: Theme.of(context).dividerColor),
Divider(color: theme.dividerColor),
ListTile(
title: Text(
L10n.of(context)!.notifications,
style: TextStyle(
color: Theme.of(context).colorScheme.primary,
color: theme.colorScheme.primary,
fontWeight: FontWeight.bold,
),
),
@ -107,12 +109,12 @@ class ChatPermissionsSettingsView extends StatelessWidget {
);
},
),
Divider(color: Theme.of(context).dividerColor),
Divider(color: theme.dividerColor),
ListTile(
title: Text(
L10n.of(context)!.configureChat,
style: TextStyle(
color: Theme.of(context).colorScheme.primary,
color: theme.colorScheme.primary,
fontWeight: FontWeight.bold,
),
),

View file

@ -71,6 +71,8 @@ class PermissionsListTile extends StatelessWidget {
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
final color = permission >= 100
? Colors.orangeAccent
: permission >= 50
@ -79,7 +81,7 @@ class PermissionsListTile extends StatelessWidget {
return ListTile(
title: Text(
getLocalizedPowerLevelString(context),
style: Theme.of(context).textTheme.titleSmall,
style: theme.textTheme.titleSmall,
),
trailing: Material(
color: color.withAlpha(32),