mirror of
https://github.com/gabehf/Fladder.git
synced 2026-03-07 21:48:14 -08:00
[Fixed] Use browser navigation
This commit is contained in:
parent
69b3a77d17
commit
d19fa0ccd0
22 changed files with 210 additions and 156 deletions
30
lib/util/router_extension.dart
Normal file
30
lib/util/router_extension.dart
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
|
||||
extension RouterExtension on StackRouter {
|
||||
Future<bool> popBack() async {
|
||||
if (kIsWeb) {
|
||||
back();
|
||||
return canNavigateBack;
|
||||
} else {
|
||||
return maybePop();
|
||||
}
|
||||
}
|
||||
|
||||
Widget? backButton() {
|
||||
if (kIsWeb && canNavigateBack) {
|
||||
return IconButton(
|
||||
onPressed: back,
|
||||
icon: const BackButtonIcon(),
|
||||
);
|
||||
} else if (canPop()) {
|
||||
return IconButton(
|
||||
onPressed: maybePop,
|
||||
icon: const BackButtonIcon(),
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue