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,8 @@ class UnreadRoomsBadge extends StatelessWidget {
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
final unreadCount = Matrix.of(context)
.client
.rooms
@ -27,17 +29,17 @@ class UnreadRoomsBadge extends StatelessWidget {
.length;
return b.Badge(
badgeStyle: b.BadgeStyle(
badgeColor: Theme.of(context).colorScheme.primary,
badgeColor: theme.colorScheme.primary,
elevation: 4,
borderSide: BorderSide(
color: Theme.of(context).colorScheme.surface,
color: theme.colorScheme.surface,
width: 2,
),
),
badgeContent: Text(
unreadCount.toString(),
style: TextStyle(
color: Theme.of(context).colorScheme.onPrimary,
color: theme.colorScheme.onPrimary,
fontSize: 12,
),
),