chore: Bring back navrail

This commit is contained in:
krille-chan 2024-07-15 21:14:49 +02:00
commit b05eb891a6
No known key found for this signature in database
11 changed files with 328 additions and 131 deletions

View file

@ -3,11 +3,13 @@ import 'package:flutter/material.dart';
class TwoColumnLayout extends StatelessWidget {
final Widget mainView;
final Widget sideView;
final bool displayNavigationRail;
const TwoColumnLayout({
super.key,
required this.mainView,
required this.sideView,
required this.displayNavigationRail,
});
@override
Widget build(BuildContext context) {
@ -18,7 +20,7 @@ class TwoColumnLayout extends StatelessWidget {
Container(
clipBehavior: Clip.antiAlias,
decoration: const BoxDecoration(),
width: 384.0,
width: 360.0 + (displayNavigationRail ? 64 : 0),
child: mainView,
),
Container(

View file

@ -19,41 +19,32 @@ class UnreadRoomsBadge extends StatelessWidget {
@override
Widget build(BuildContext context) {
return StreamBuilder(
stream: Matrix.of(context)
.client
.onSync
.stream
.where((syncUpdate) => syncUpdate.hasRoomUpdate),
builder: (context, _) {
final unreadCount = Matrix.of(context)
.client
.rooms
.where(filter)
.where((r) => (r.isUnread || r.membership == Membership.invite))
.length;
return b.Badge(
badgeStyle: b.BadgeStyle(
badgeColor: Theme.of(context).colorScheme.primary,
elevation: 4,
borderSide: BorderSide(
color: Theme.of(context).colorScheme.surface,
width: 2,
),
),
badgeContent: Text(
unreadCount.toString(),
style: TextStyle(
color: Theme.of(context).colorScheme.onPrimary,
fontSize: 12,
),
),
showBadge: unreadCount != 0,
badgeAnimation: const b.BadgeAnimation.scale(),
position: badgePosition ?? b.BadgePosition.bottomEnd(),
child: child,
);
},
final unreadCount = Matrix.of(context)
.client
.rooms
.where(filter)
.where((r) => (r.isUnread || r.membership == Membership.invite))
.length;
return b.Badge(
badgeStyle: b.BadgeStyle(
badgeColor: Theme.of(context).colorScheme.primary,
elevation: 4,
borderSide: BorderSide(
color: Theme.of(context).colorScheme.surface,
width: 2,
),
),
badgeContent: Text(
unreadCount.toString(),
style: TextStyle(
color: Theme.of(context).colorScheme.onPrimary,
fontSize: 12,
),
),
showBadge: unreadCount != 0,
badgeAnimation: const b.BadgeAnimation.scale(),
position: badgePosition ?? b.BadgePosition.bottomEnd(),
child: child,
);
}
}