refactor: update back navigation to prioritize popping the route stack before defaulting to home
This commit is contained in:
@@ -154,7 +154,13 @@ class AgentNetworkScreen extends ConsumerWidget {
|
||||
child: Row(
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () => context.go('/home'),
|
||||
onTap: () {
|
||||
if (Navigator.of(context).canPop()) {
|
||||
Navigator.of(context).pop();
|
||||
} else {
|
||||
context.go('/home');
|
||||
}
|
||||
},
|
||||
child: const Icon(
|
||||
Icons.arrow_back_ios_new_rounded,
|
||||
size: 18,
|
||||
|
||||
@@ -122,7 +122,13 @@ class _AgentSearchScreenState extends ConsumerState<AgentSearchScreen> {
|
||||
child: Row(
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () => context.go('/home'),
|
||||
onTap: () {
|
||||
if (Navigator.of(context).canPop()) {
|
||||
Navigator.of(context).pop();
|
||||
} else {
|
||||
context.go('/home');
|
||||
}
|
||||
},
|
||||
child: const Padding(
|
||||
padding: EdgeInsets.only(right: 8),
|
||||
child: Icon(
|
||||
|
||||
@@ -75,6 +75,8 @@ class _ConversationsScreenState extends ConsumerState<ConversationsScreen> {
|
||||
_isSearchActive = false;
|
||||
_searchController.clear();
|
||||
});
|
||||
} else if (Navigator.of(context).canPop()) {
|
||||
Navigator.of(context).pop();
|
||||
} else {
|
||||
context.go('/home');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user