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(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () => context.go('/home'),
|
onTap: () {
|
||||||
|
if (Navigator.of(context).canPop()) {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
} else {
|
||||||
|
context.go('/home');
|
||||||
|
}
|
||||||
|
},
|
||||||
child: const Icon(
|
child: const Icon(
|
||||||
Icons.arrow_back_ios_new_rounded,
|
Icons.arrow_back_ios_new_rounded,
|
||||||
size: 18,
|
size: 18,
|
||||||
|
|||||||
@@ -122,7 +122,13 @@ class _AgentSearchScreenState extends ConsumerState<AgentSearchScreen> {
|
|||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () => context.go('/home'),
|
onTap: () {
|
||||||
|
if (Navigator.of(context).canPop()) {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
} else {
|
||||||
|
context.go('/home');
|
||||||
|
}
|
||||||
|
},
|
||||||
child: const Padding(
|
child: const Padding(
|
||||||
padding: EdgeInsets.only(right: 8),
|
padding: EdgeInsets.only(right: 8),
|
||||||
child: Icon(
|
child: Icon(
|
||||||
|
|||||||
@@ -75,6 +75,8 @@ class _ConversationsScreenState extends ConsumerState<ConversationsScreen> {
|
|||||||
_isSearchActive = false;
|
_isSearchActive = false;
|
||||||
_searchController.clear();
|
_searchController.clear();
|
||||||
});
|
});
|
||||||
|
} else if (Navigator.of(context).canPop()) {
|
||||||
|
Navigator.of(context).pop();
|
||||||
} else {
|
} else {
|
||||||
context.go('/home');
|
context.go('/home');
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user