small fixups
This commit is contained in:
parent
bab699658f
commit
e300f4efc9
4 changed files with 21 additions and 17 deletions
|
|
@ -1,6 +1,6 @@
|
|||
import "package:flutter_riverpod/flutter_riverpod.dart";
|
||||
|
||||
class JumpToEventController extends Notifier<String?> {
|
||||
class JumpToEventController(String? _) extends Notifier<String?> {
|
||||
@override
|
||||
String? build() => null;
|
||||
|
||||
|
|
@ -9,7 +9,8 @@ class JumpToEventController extends Notifier<String?> {
|
|||
@override
|
||||
bool updateShouldNotify(_, _) => true;
|
||||
|
||||
static final provider = NotifierProvider<JumpToEventController, String?>(
|
||||
JumpToEventController.new,
|
||||
);
|
||||
static final provider = NotifierProvider.family
|
||||
.autoDispose<JumpToEventController, String?, String?>(
|
||||
JumpToEventController.new,
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ class const ChatPage({super.key}) extends HookConsumerWidget {
|
|||
child: Consumer(
|
||||
builder: (context, ref, _) {
|
||||
final initialHighlight = ref.watch(
|
||||
JumpToEventController.provider,
|
||||
JumpToEventController.provider(roomId),
|
||||
);
|
||||
return RoomChat(
|
||||
key: ValueKey((roomId, initialHighlight)),
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ class const NotificationsPage({
|
|||
padding: .only(top: 8),
|
||||
child: HighlightWrapper(
|
||||
InkWell(
|
||||
onTap: () {
|
||||
onTap: () async {
|
||||
final spaces = ref.read(
|
||||
SpacesController.provider,
|
||||
);
|
||||
|
|
@ -152,14 +152,14 @@ class const NotificationsPage({
|
|||
);
|
||||
if (space == null) return;
|
||||
|
||||
ref
|
||||
await ref
|
||||
.read(
|
||||
KeyController.provider(
|
||||
KeyController.spaceKey,
|
||||
).notifier,
|
||||
)
|
||||
.set(space.id);
|
||||
ref
|
||||
await ref
|
||||
.read(
|
||||
KeyController.provider(
|
||||
KeyController.roomKey,
|
||||
|
|
@ -167,14 +167,16 @@ class const NotificationsPage({
|
|||
)
|
||||
.set(event.roomId);
|
||||
ref
|
||||
.read(
|
||||
JumpToEventController
|
||||
.provider
|
||||
.notifier,
|
||||
.watch(
|
||||
JumpToEventController.provider(
|
||||
event.roomId,
|
||||
).notifier,
|
||||
)
|
||||
.set(event.eventId);
|
||||
|
||||
Navigator.of(context).pop();
|
||||
if (context.mounted) {
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
},
|
||||
child: IgnorePointer(
|
||||
child: EventRenderer(event),
|
||||
|
|
|
|||
|
|
@ -192,13 +192,14 @@ class const Sidebar({required final bool isDesktop, super.key})
|
|||
),
|
||||
IconButton(
|
||||
tooltip: "Open notifications",
|
||||
onPressed: () => Navigator.of(context)
|
||||
..pop()
|
||||
..push(
|
||||
onPressed: () {
|
||||
if (!isDesktop) Navigator.of(context).pop();
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder: (_) => NotificationsPage(),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
icon: Icon(Icons.notifications),
|
||||
),
|
||||
IconButton(
|
||||
|
|
|
|||
Loading…
Reference in a new issue