feat: enforce hierarchical back navigation and home-only exit

This commit is contained in:
qzl
2026-03-20 15:20:29 +08:00
parent 19a2cd451d
commit cbbed29a75
7 changed files with 31 additions and 11 deletions
@@ -8,7 +8,11 @@ enum HomeReturnAction { pop, goHome }
HomeReturnAction resolveHomeReturnAction({
required bool canPop,
required bool isAuthEntry,
bool forceGoHome = false,
}) {
if (forceGoHome) {
return HomeReturnAction.goHome;
}
if (isAuthEntry) {
return HomeReturnAction.goHome;
}
@@ -21,10 +25,12 @@ HomeReturnAction resolveHomeReturnAction({
void returnToHomePreserveState(
BuildContext context, {
bool isAuthEntry = false,
bool forceGoHome = false,
}) {
final action = resolveHomeReturnAction(
canPop: context.canPop(),
isAuthEntry: isAuthEntry,
forceGoHome: forceGoHome,
);
switch (action) {
case HomeReturnAction.pop: