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

@ -27,20 +27,19 @@ class ReplyContent extends StatelessWidget {
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
final timeline = this.timeline;
final displayEvent =
timeline != null ? replyEvent.getDisplayEvent(timeline) : replyEvent;
final fontSize = AppConfig.messageFontSize * AppConfig.fontSizeFactor;
final color = ownMessage
? Theme.of(context).colorScheme.primaryContainer
: Theme.of(context).colorScheme.primary;
? theme.colorScheme.primaryContainer
: theme.colorScheme.primary;
return Material(
color: backgroundColor ??
Theme.of(context)
.colorScheme
.surface
.withOpacity(ownMessage ? 0.2 : 0.33),
theme.colorScheme.surface.withOpacity(ownMessage ? 0.2 : 0.33),
borderRadius: borderRadius,
child: Row(
mainAxisSize: MainAxisSize.min,
@ -81,8 +80,8 @@ class ReplyContent extends StatelessWidget {
maxLines: 1,
style: TextStyle(
color: ownMessage
? Theme.of(context).colorScheme.onPrimary
: Theme.of(context).colorScheme.onSurface,
? theme.colorScheme.onPrimary
: theme.colorScheme.onSurface,
fontSize: fontSize,
),
),