Add back button fallback to go to /home if the view can not be popped

This commit is contained in:
Shawn 2023-11-02 09:57:01 -06:00
parent 8c3ef002a8
commit 0805da1b37

View File

@ -109,7 +109,14 @@ class BackBtn extends StatelessWidget {
icon: icon, icon: icon,
bgColor: bgColor, bgColor: bgColor,
color: iconColor, color: iconColor,
onPressed: onPressed ?? () => Navigator.pop(context), onPressed: onPressed ?? () {
final nav = Navigator.of(context);
if(nav.canPop()){
Navigator.pop(context);
} else {
context.go(ScreenPaths.home);
}
},
semanticLabel: semanticLabel ?? $strings.circleButtonsSemanticBack, semanticLabel: semanticLabel ?? $strings.circleButtonsSemanticBack,
); );
} }