Commit cc320d61 authored by SpeciedCrab's avatar SpeciedCrab

fix 1.17

parent db7ca34a
......@@ -41,7 +41,7 @@ enum ContainerLifeCycle {
typedef BoostContainerLifeCycleObserver = void Function(
ContainerLifeCycle state,
BoostContainerSettings settings,
);
);
class BoostContainer extends Navigator {
const BoostContainer({
......@@ -161,6 +161,15 @@ class BoostContainerState extends NavigatorState {
void initState() {
super.initState();
backPressedHandler = () => maybePop();
final String initRoute = widget.initialRoute ?? Navigator.defaultRouteName;
if (initRoute != null && routerHistory.isEmpty) {
routerHistory.addAll(
widget.onGenerateInitialRoutes(
this,
widget.initialRoute ?? Navigator.defaultRouteName
)
);
}
}
@override
......@@ -177,7 +186,13 @@ class BoostContainerState extends NavigatorState {
@override
Future<bool> maybePop<T extends Object>([T result]) async {
if(routerHistory.isEmpty) {
pop(result);
return true;
}
final Route<T> route = routerHistory.last as Route<T>;
final RoutePopDisposition disposition = await route.willPop();
if (mounted) {
switch (disposition) {
......
......@@ -62,4 +62,9 @@ class BoostPageRoute<T> extends MaterialPageRoute<T> {
return null;
}
}
@override
Future<RoutePopDisposition> willPop() {
return Future<RoutePopDisposition>.value(RoutePopDisposition.pop);
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment