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

@ -22,6 +22,7 @@ class DevicesSettingsView extends StatelessWidget {
child: FutureBuilder<bool>(
future: controller.loadUserDevices(context),
builder: (BuildContext context, snapshot) {
final theme = Theme.of(context);
if (snapshot.hasError) {
return Center(
child: Column(
@ -58,7 +59,7 @@ class DevicesSettingsView extends StatelessWidget {
L10n.of(context)!.thisDevice,
style: TextStyle(
fontWeight: FontWeight.bold,
color: Theme.of(context).colorScheme.primary,
color: theme.colorScheme.primary,
),
textAlign: TextAlign.left,
),
@ -86,12 +87,10 @@ class DevicesSettingsView extends StatelessWidget {
L10n.of(context)!.removeAllOtherDevices,
),
style: TextButton.styleFrom(
foregroundColor: Theme.of(context)
.colorScheme
.onErrorContainer,
backgroundColor: Theme.of(context)
.colorScheme
.errorContainer,
foregroundColor:
theme.colorScheme.onErrorContainer,
backgroundColor:
theme.colorScheme.errorContainer,
),
icon: controller.loadingDeletingDevices
? const CircularProgressIndicator.adaptive(