add theming workaround for navigation_rail_m3e

This commit is contained in:
Henry Hiles 2026-08-22 15:12:35 -04:00
commit a090d88a23
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs
2 changed files with 189 additions and 167 deletions

View file

@ -12,6 +12,9 @@ import "package:nexus/widgets/divider_widget.dart";
import "package:nexus/widgets/join_dialog.dart";
import "package:nexus/widgets/room_menu.dart";
// Needed for navigation_rail_m3e (#65).
import "package:flutter/material.dart" as old_mat;
class const Sidebar({required final bool isDesktop, super.key})
extends HookConsumerWidget {
@override
@ -72,8 +75,10 @@ class const Sidebar({required final bool isDesktop, super.key})
shape: Border(),
child: Row(
children: [
Theme(
data: Theme.of(context).copyWith(
MaterialUiCompatibilityBridge(
child: Builder(
builder: (context) => old_mat.Theme(
data: old_mat.Theme.of(context).copyWith(
extensions: [
NavigationRailM3ETheme(
itemCollapsedHeight: 48,
@ -109,20 +114,24 @@ class const Sidebar({required final bool isDesktop, super.key})
0,
(previousValue, room) =>
previousValue +
(room.metadata?.unreadNotifications ?? 0),
(room.metadata?.unreadNotifications ??
0),
)) {
0 =>
space.children
.addAll(
space.subSpaces
.map(
(element) => element.children,
(element) =>
element.children,
)
.flattened,
)
.any(
(room) =>
room.metadata?.unreadMessages !=
room
.metadata
?.unreadMessages !=
0,
)
? 0
@ -159,7 +168,9 @@ class const Sidebar({required final bool isDesktop, super.key})
builder: (_) => JoinDialog(ref),
),
child: ListTile(
title: Text("Join an existing room (or space)"),
title: Text(
"Join an existing room (or space)",
),
leading: Icon(Icons.numbers),
),
),
@ -192,6 +203,9 @@ class const Sidebar({required final bool isDesktop, super.key})
),
),
),
),
),
Expanded(
child: Scaffold(
backgroundColor: Colors.transparent,
@ -217,8 +231,10 @@ class const Sidebar({required final bool isDesktop, super.key})
),
],
),
body: Theme(
data: Theme.of(context).copyWith(
body: MaterialUiCompatibilityBridge(
child: Builder(
builder: (context) => old_mat.Theme(
data: old_mat.Theme.of(context).copyWith(
extensions: [
NavigationRailM3ETheme(
itemExpandedHeight: 48,
@ -237,7 +253,9 @@ class const Sidebar({required final bool isDesktop, super.key})
header: selectedSpace.room == null
? null
: DividerWidget(Text("Rooms")),
destinations: roomsToDestinations(selectedSpace.children),
destinations: roomsToDestinations(
selectedSpace.children,
),
),
for (final subSpace in selectedSpace.subSpaces)
.new(
@ -264,7 +282,9 @@ class const Sidebar({required final bool isDesktop, super.key})
],
),
),
destinations: roomsToDestinations(subSpace.children),
destinations: roomsToDestinations(
subSpace.children,
),
),
],
onDestinationSelected: (value) {
@ -282,6 +302,8 @@ class const Sidebar({required final bool isDesktop, super.key})
),
),
),
),
),
],
),
);

View file

@ -1004,7 +1004,7 @@ packages:
description:
path: "packages/navigation_rail_m3e"
ref: HEAD
resolved-ref: c9edb0be7251e1a31e2336444f00557eb93ca09d
resolved-ref: da860a413d5cf78b9c9c967215250bcdbfe5191d
url: "https://github.com/Henry-Hiles/material_3_expressive"
source: git
version: "0.3.5"