chore: Bring back navrail
This commit is contained in:
parent
282188f574
commit
b05eb891a6
11 changed files with 328 additions and 131 deletions
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue