From 3b12d8ab8432d3a4ab65b8db32cc1d8385e34109 Mon Sep 17 00:00:00 2001 From: krille-chan Date: Sat, 19 Aug 2023 08:17:40 +0200 Subject: [PATCH] refactor: Update badge --- lib/widgets/unread_rooms_badge.dart | 19 ++++++++++--------- pubspec.lock | 4 ++-- pubspec.yaml | 2 +- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/lib/widgets/unread_rooms_badge.dart b/lib/widgets/unread_rooms_badge.dart index 6ebde3c97..2110e4e33 100644 --- a/lib/widgets/unread_rooms_badge.dart +++ b/lib/widgets/unread_rooms_badge.dart @@ -33,7 +33,14 @@ class UnreadRoomsBadge extends StatelessWidget { .where((r) => (r.isUnread || r.membership == Membership.invite)) .length; return b.Badge( - alignment: Alignment.bottomRight, + badgeStyle: b.BadgeStyle( + badgeColor: Theme.of(context).colorScheme.primary, + elevation: 4, + borderSide: BorderSide( + color: Theme.of(context).colorScheme.background, + width: 2, + ), + ), badgeContent: Text( unreadCount.toString(), style: TextStyle( @@ -42,14 +49,8 @@ class UnreadRoomsBadge extends StatelessWidget { ), ), showBadge: unreadCount != 0, - animationType: b.BadgeAnimationType.scale, - badgeColor: Theme.of(context).colorScheme.primary, - position: badgePosition, - elevation: 4, - borderSide: BorderSide( - color: Theme.of(context).colorScheme.background, - width: 2, - ), + badgeAnimation: const b.BadgeAnimation.scale(), + position: badgePosition ?? b.BadgePosition.bottomEnd(), child: child, ); }, diff --git a/pubspec.lock b/pubspec.lock index 1ea784b54..0b720cb1a 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -85,10 +85,10 @@ packages: dependency: "direct main" description: name: badges - sha256: "727580d938b7a1ff47ea42df730d581415606b4224cfa708671c10287f8d3fe6" + sha256: "6e7f3ec561ec08f47f912cfe349d4a1707afdc8dda271e17b046aa6d42c89e77" url: "https://pub.dev" source: hosted - version: "2.0.3" + version: "3.1.1" base58check: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index da4afefe7..56f325146 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -10,7 +10,7 @@ dependencies: adaptive_dialog: ^1.9.0-x-macos-beta.1 animations: ^2.0.7 archive: ^3.3.7 - badges: ^2.0.3 + badges: ^3.1.1 blurhash_dart: ^1.1.0 callkeep: ^0.3.2 chewie: ^1.3.6