Dashboard navigation and page transitions improvements

This commit is contained in:
Igor Kulikov
2021-06-07 16:23:02 +03:00
parent a6d89f1d0c
commit 8c519540ba
5 changed files with 71 additions and 14 deletions

View File

@@ -349,7 +349,7 @@ class TbContext {
if (replace) {
transition = TransitionType.fadeIn;
} else {
transition = TransitionType.inFromRight;
transition = TransitionType.native;
}
}
var res = await router.navigateTo(currentState!.context, path, transition: transition, transitionDuration: transitionDuration, replace: replace, clearStack: clearStack);
@@ -364,9 +364,10 @@ class TbContext {
await _mainDashboardHolder?.navigateToDashboard(dashboardId, dashboardTitle: dashboardTitle, state: state, hideToolbar: hideToolbar, animate: animate);
}
void pop<T>([T? result]) {
if (currentState != null) {
router.pop<T>(currentState!.context, result);
void pop<T>([T? result, BuildContext? context]) {
var targetContext = context ?? currentState?.context;
if (targetContext != null) {
router.pop<T>(targetContext, result);
}
}
@@ -391,9 +392,9 @@ class TbContext {
title: Text(title),
content: Text(message),
actions: [
TextButton(onPressed: () => pop(false),
TextButton(onPressed: () => pop(false, context),
child: Text(cancel)),
TextButton(onPressed: () => pop(true),
TextButton(onPressed: () => pop(true, context),
child: Text(ok))
],
));