small fixups

This commit is contained in:
Henry Hiles 2026-09-26 21:11:11 -04:00
commit e300f4efc9
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs
4 changed files with 21 additions and 17 deletions

View file

@ -1,6 +1,6 @@
import "package:flutter_riverpod/flutter_riverpod.dart"; import "package:flutter_riverpod/flutter_riverpod.dart";
class JumpToEventController extends Notifier<String?> { class JumpToEventController(String? _) extends Notifier<String?> {
@override @override
String? build() => null; String? build() => null;
@ -9,7 +9,8 @@ class JumpToEventController extends Notifier<String?> {
@override @override
bool updateShouldNotify(_, _) => true; bool updateShouldNotify(_, _) => true;
static final provider = NotifierProvider<JumpToEventController, String?>( static final provider = NotifierProvider.family
.autoDispose<JumpToEventController, String?, String?>(
JumpToEventController.new, JumpToEventController.new,
); );
} }

View file

@ -30,7 +30,7 @@ class const ChatPage({super.key}) extends HookConsumerWidget {
child: Consumer( child: Consumer(
builder: (context, ref, _) { builder: (context, ref, _) {
final initialHighlight = ref.watch( final initialHighlight = ref.watch(
JumpToEventController.provider, JumpToEventController.provider(roomId),
); );
return RoomChat( return RoomChat(
key: ValueKey((roomId, initialHighlight)), key: ValueKey((roomId, initialHighlight)),

View file

@ -130,7 +130,7 @@ class const NotificationsPage({
padding: .only(top: 8), padding: .only(top: 8),
child: HighlightWrapper( child: HighlightWrapper(
InkWell( InkWell(
onTap: () { onTap: () async {
final spaces = ref.read( final spaces = ref.read(
SpacesController.provider, SpacesController.provider,
); );
@ -152,14 +152,14 @@ class const NotificationsPage({
); );
if (space == null) return; if (space == null) return;
ref await ref
.read( .read(
KeyController.provider( KeyController.provider(
KeyController.spaceKey, KeyController.spaceKey,
).notifier, ).notifier,
) )
.set(space.id); .set(space.id);
ref await ref
.read( .read(
KeyController.provider( KeyController.provider(
KeyController.roomKey, KeyController.roomKey,
@ -167,14 +167,16 @@ class const NotificationsPage({
) )
.set(event.roomId); .set(event.roomId);
ref ref
.read( .watch(
JumpToEventController JumpToEventController.provider(
.provider event.roomId,
.notifier, ).notifier,
) )
.set(event.eventId); .set(event.eventId);
if (context.mounted) {
Navigator.of(context).pop(); Navigator.of(context).pop();
}
}, },
child: IgnorePointer( child: IgnorePointer(
child: EventRenderer(event), child: EventRenderer(event),

View file

@ -192,13 +192,14 @@ class const Sidebar({required final bool isDesktop, super.key})
), ),
IconButton( IconButton(
tooltip: "Open notifications", tooltip: "Open notifications",
onPressed: () => Navigator.of(context) onPressed: () {
..pop() if (!isDesktop) Navigator.of(context).pop();
..push( Navigator.of(context).push(
MaterialPageRoute( MaterialPageRoute(
builder: (_) => NotificationsPage(), builder: (_) => NotificationsPage(),
), ),
), );
},
icon: Icon(Icons.notifications), icon: Icon(Icons.notifications),
), ),
IconButton( IconButton(