Add back button fallback to go to /home if the view can not be popped
This commit is contained in:
parent
8c3ef002a8
commit
0805da1b37
@ -109,7 +109,14 @@ class BackBtn extends StatelessWidget {
|
||||
icon: icon,
|
||||
bgColor: bgColor,
|
||||
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,
|
||||
);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user