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

@ -17,14 +17,15 @@ class HomeserverAppBar extends StatelessWidget {
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
return TypeAheadField<PublicHomeserver>(
decorationBuilder: (context, child) => ConstrainedBox(
constraints: const BoxConstraints(maxHeight: 256),
child: Material(
borderRadius: BorderRadius.circular(AppConfig.borderRadius),
elevation: Theme.of(context).appBarTheme.scrolledUnderElevation ?? 4,
shadowColor:
Theme.of(context).appBarTheme.shadowColor ?? Colors.black,
elevation: theme.appBarTheme.scrolledUnderElevation ?? 4,
shadowColor: theme.appBarTheme.shadowColor ?? Colors.black,
child: child,
),
),
@ -92,9 +93,9 @@ class HomeserverAppBar extends StatelessWidget {
)
: null,
fillColor: FluffyThemes.isColumnMode(context)
? Theme.of(context).colorScheme.surface
? theme.colorScheme.surface
// ignore: deprecated_member_use
: Theme.of(context).colorScheme.surfaceVariant,
: theme.colorScheme.surfaceVariant,
prefixText: '${L10n.of(context)!.homeserver}: ',
hintText: L10n.of(context)!.enterYourHomeserver,
suffixIcon: const Icon(Icons.search),