feat: enhance routing and state management in Dashbot components

This commit is contained in:
Udhay-Adithya
2025-09-21 02:14:38 +05:30
parent 671e4218cc
commit f8d54da074
6 changed files with 36 additions and 30 deletions

View File

@@ -30,20 +30,23 @@ class _DashbotTabState extends ConsumerState<DashbotTab>
ref.listen(
selectedRequestModelProvider,
(prev, next) {
if (next?.responseStatus != null) {
if (prev?.id == next?.id) return;
final initial = _navKey.currentState?.widget.initialRoute;
final atRoot = _navKey.currentState?.canPop() == false;
if (initial == DashbotRoutes.dashbotDefault && atRoot) {
_navKey.currentState?.pushNamed(DashbotRoutes.dashbotHome);
}
},
);
return WillPopScope(
onWillPop: () async {
return PopScope(
canPop: true,
onPopInvokedWithResult: (didPop, _) {
if (didPop) return;
final canPop = _navKey.currentState?.canPop() ?? false;
if (canPop) {
_navKey.currentState?.pop();
return false;
}
return true;
},
child: Padding(
padding: kP10,