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

@ -23,6 +23,8 @@ class LoginScaffold extends StatelessWidget {
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
final isMobileMode =
enforceMobileMode || !FluffyThemes.isColumnMode(context);
final scaffold = Scaffold(
@ -40,13 +42,12 @@ class LoginScaffold extends StatelessWidget {
backgroundColor: isMobileMode ? null : Colors.transparent,
),
body: body,
backgroundColor: isMobileMode
? null
: Theme.of(context).colorScheme.surface.withOpacity(0.8),
backgroundColor:
isMobileMode ? null : theme.colorScheme.surface.withOpacity(0.8),
bottomNavigationBar: isMobileMode
? Material(
elevation: 4,
shadowColor: Theme.of(context).colorScheme.onSurface,
shadowColor: theme.colorScheme.onSurface,
child: const _PrivacyButtons(
mainAxisAlignment: MainAxisAlignment.center,
),
@ -72,9 +73,8 @@ class LoginScaffold extends StatelessWidget {
color: Colors.transparent,
borderRadius: BorderRadius.circular(AppConfig.borderRadius),
clipBehavior: Clip.hardEdge,
elevation:
Theme.of(context).appBarTheme.scrolledUnderElevation ?? 4,
shadowColor: Theme.of(context).appBarTheme.shadowColor,
elevation: theme.appBarTheme.scrolledUnderElevation ?? 4,
shadowColor: theme.appBarTheme.shadowColor,
child: ConstrainedBox(
constraints: isMobileMode
? const BoxConstraints()