refactor: update navigation to use push/pop and add conditional dashboard redirection for agents
This commit is contained in:
@@ -193,7 +193,13 @@ class _ChatScreenState extends ConsumerState<ChatScreen>
|
||||
onConfirm: () async {
|
||||
final notifier = ref.read(messagingProvider.notifier);
|
||||
await notifier.deleteConversation(widget.conversationId);
|
||||
if (mounted) context.go('/messages');
|
||||
if (mounted) {
|
||||
if (Navigator.of(context).canPop()) {
|
||||
Navigator.of(context).pop();
|
||||
} else {
|
||||
context.go('/messages');
|
||||
}
|
||||
}
|
||||
},
|
||||
isDanger: true,
|
||||
);
|
||||
@@ -266,8 +272,13 @@ class _ChatScreenState extends ConsumerState<ChatScreen>
|
||||
}
|
||||
|
||||
void _handleBack() {
|
||||
ref.read(messagingProvider.notifier).setActiveConversation(null);
|
||||
context.go('/messages');
|
||||
final notifier = ref.read(messagingProvider.notifier);
|
||||
Future.microtask(() => notifier.setActiveConversation(null));
|
||||
if (Navigator.of(context).canPop()) {
|
||||
Navigator.of(context).pop();
|
||||
} else {
|
||||
context.go('/messages');
|
||||
}
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
|
||||
Reference in New Issue
Block a user