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

@ -19,6 +19,7 @@ class SettingsView extends StatelessWidget {
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
final showChatBackupBanner = controller.showChatBackupBanner;
return Scaffold(
appBar: AppBar(
@ -30,7 +31,7 @@ class SettingsView extends StatelessWidget {
title: Text(L10n.of(context)!.settings),
),
body: ListTileTheme(
iconColor: Theme.of(context).colorScheme.onSurface,
iconColor: theme.colorScheme.onSurface,
child: ListView(
key: const Key('SettingsListViewContent'),
children: <Widget>[
@ -79,8 +80,7 @@ class SettingsView extends StatelessWidget {
size: 16,
),
style: TextButton.styleFrom(
foregroundColor:
Theme.of(context).colorScheme.onSurface,
foregroundColor: theme.colorScheme.onSurface,
),
label: Text(
displayname,
@ -98,8 +98,7 @@ class SettingsView extends StatelessWidget {
size: 14,
),
style: TextButton.styleFrom(
foregroundColor:
Theme.of(context).colorScheme.secondary,
foregroundColor: theme.colorScheme.secondary,
),
label: Text(
mxid,
@ -115,7 +114,7 @@ class SettingsView extends StatelessWidget {
);
},
),
Divider(color: Theme.of(context).dividerColor),
Divider(color: theme.dividerColor),
if (showChatBackupBanner == null)
ListTile(
leading: const Icon(Icons.backup_outlined),
@ -131,7 +130,7 @@ class SettingsView extends StatelessWidget {
onChanged: controller.firstRunBootstrapAction,
),
Divider(
color: Theme.of(context).dividerColor,
color: theme.dividerColor,
),
ListTile(
leading: const Icon(Icons.format_paint_outlined),
@ -158,7 +157,7 @@ class SettingsView extends StatelessWidget {
title: Text(L10n.of(context)!.security),
onTap: () => context.go('/rooms/settings/security'),
),
Divider(color: Theme.of(context).dividerColor),
Divider(color: theme.dividerColor),
ListTile(
leading: const Icon(Icons.help_outline_outlined),
title: Text(L10n.of(context)!.help),
@ -174,7 +173,7 @@ class SettingsView extends StatelessWidget {
title: Text(L10n.of(context)!.about),
onTap: () => PlatformInfos.showDialog(context),
),
Divider(color: Theme.of(context).dividerColor),
Divider(color: theme.dividerColor),
ListTile(
leading: const Icon(Icons.logout_outlined),
title: Text(L10n.of(context)!.logout),