22 lines
651 B
Dart
22 lines
651 B
Dart
import 'package:flutter/material.dart';
|
|
import 'package:go_router/go_router.dart';
|
|
|
|
/// Back to previous route, or to the public welcome landing when there is no stack.
|
|
void popToWelcomeOrPrevious(BuildContext context) {
|
|
if (context.canPop()) {
|
|
context.pop();
|
|
return;
|
|
}
|
|
context.go('/welcome');
|
|
}
|
|
|
|
/// App bar leading that returns to welcome / previous guest screen.
|
|
Widget welcomeBackButton(BuildContext context, {Key? key}) {
|
|
return IconButton(
|
|
key: key,
|
|
tooltip: MaterialLocalizations.of(context).backButtonTooltip,
|
|
icon: const Icon(Icons.arrow_back_rounded),
|
|
onPressed: () => popToWelcomeOrPrevious(context),
|
|
);
|
|
}
|