refactor: update navigation to use push/pop and add conditional dashboard redirection for agents
This commit is contained in:
@@ -847,7 +847,9 @@ class AboutScreen extends ConsumerWidget {
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
cta.buttonText,
|
||||
(ref.read(authProvider).user?.role == 'AGENT')
|
||||
? 'Go to Dashboard'
|
||||
: cta.buttonText,
|
||||
style: const TextStyle(
|
||||
fontFamily: 'Fractul',
|
||||
fontSize: 16,
|
||||
|
||||
@@ -613,8 +613,10 @@ class _ContactScreenState extends State<ContactScreen> {
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const Text(
|
||||
'Start Your Search',
|
||||
Text(
|
||||
(ref.read(authProvider).user?.role == 'AGENT')
|
||||
? 'Go to Dashboard'
|
||||
: 'Start Your Search',
|
||||
style: TextStyle(
|
||||
fontFamily: 'Fractul',
|
||||
fontSize: 16,
|
||||
|
||||
@@ -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,9 +272,14 @@ class _ChatScreenState extends ConsumerState<ChatScreen>
|
||||
}
|
||||
|
||||
void _handleBack() {
|
||||
ref.read(messagingProvider.notifier).setActiveConversation(null);
|
||||
final notifier = ref.read(messagingProvider.notifier);
|
||||
Future.microtask(() => notifier.setActiveConversation(null));
|
||||
if (Navigator.of(context).canPop()) {
|
||||
Navigator.of(context).pop();
|
||||
} else {
|
||||
context.go('/messages');
|
||||
}
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// DATE / TIME FORMATTING
|
||||
|
||||
@@ -434,7 +434,7 @@ class _ConversationsScreenState extends ConsumerState<ConversationsScreen> {
|
||||
return _ConversationTile(
|
||||
conversation: filtered[index],
|
||||
onTap: () =>
|
||||
context.go('/messages/chat/${filtered[index].id}'),
|
||||
context.push('/messages/chat/${filtered[index].id}'),
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user