Add unreads back
This commit is contained in:
parent
b63c225ea5
commit
76b81ab8c4
4 changed files with 36 additions and 47 deletions
|
|
@ -26,7 +26,7 @@ class RoomAppbar extends StatelessWidget implements PreferredSizeWidget {
|
|||
? AvatarOrHash(
|
||||
room.avatar,
|
||||
room.title,
|
||||
height: 32,
|
||||
height: 24,
|
||||
fallback: Icon(Icons.numbers),
|
||||
headers: room.roomData.client.headers,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import "package:nexus/controllers/spaces_controller.dart";
|
|||
import "package:nexus/helpers/extension_helper.dart";
|
||||
import "package:nexus/pages/settings_page.dart";
|
||||
import "package:nexus/widgets/avatar_or_hash.dart";
|
||||
import "package:nexus/widgets/chat_page/unread.dart";
|
||||
|
||||
class Sidebar extends HookConsumerWidget {
|
||||
const Sidebar({super.key});
|
||||
|
|
@ -47,18 +46,16 @@ class Sidebar extends HookConsumerWidget {
|
|||
destinations: spaces
|
||||
.map(
|
||||
(space) => NavigationRailDestination(
|
||||
icon: Unread(
|
||||
isUnread:
|
||||
icon: AvatarOrHash(
|
||||
space.avatar,
|
||||
fallback: space.icon,
|
||||
space.title,
|
||||
headers: space.client.headers,
|
||||
hasBadge:
|
||||
space.children.firstWhereOrNull(
|
||||
(room) => room.roomData.hasNewMessages,
|
||||
) !=
|
||||
null,
|
||||
child: AvatarOrHash(
|
||||
space.avatar,
|
||||
fallback: space.icon,
|
||||
space.title,
|
||||
headers: space.client.headers,
|
||||
),
|
||||
),
|
||||
label: Text(space.title),
|
||||
padding: EdgeInsets.only(top: 4),
|
||||
|
|
@ -110,16 +107,14 @@ class Sidebar extends HookConsumerWidget {
|
|||
.map(
|
||||
(room) => NavigationRailDestination(
|
||||
label: Text(room.title),
|
||||
icon: Unread(
|
||||
isUnread: room.roomData.hasNewMessages,
|
||||
child: AvatarOrHash(
|
||||
room.avatar,
|
||||
room.title,
|
||||
fallback: selectedSpace == 1
|
||||
? null
|
||||
: Icon(Icons.numbers),
|
||||
headers: space.client.headers,
|
||||
),
|
||||
icon: AvatarOrHash(
|
||||
hasBadge: room.roomData.hasNewMessages,
|
||||
room.avatar,
|
||||
room.title,
|
||||
fallback: selectedSpace == 1
|
||||
? null
|
||||
: Icon(Icons.numbers),
|
||||
headers: space.client.headers,
|
||||
),
|
||||
),
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,15 +0,0 @@
|
|||
import "package:flutter/material.dart";
|
||||
|
||||
class Unread extends StatelessWidget {
|
||||
final bool isUnread;
|
||||
final Widget child;
|
||||
const Unread({required this.isUnread, required this.child, super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Badge(
|
||||
smallSize: 8,
|
||||
backgroundColor: Theme.of(context).colorScheme.primary,
|
||||
isLabelVisible: isUnread,
|
||||
child: child,
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue