@@ -8,6 +8,7 @@ import 'package:ensemble/action/navigation_action.dart';
8
8
import 'package:ensemble/action/phone_contact_action.dart' ;
9
9
import 'package:ensemble/action/upload_files_action.dart' ;
10
10
import 'package:ensemble/ensemble.dart' ;
11
+ import 'package:ensemble/ensemble_app.dart' ;
11
12
import 'package:ensemble/framework/action.dart' ;
12
13
import 'package:ensemble/framework/apiproviders/api_provider.dart' ;
13
14
import 'package:ensemble/framework/bindings.dart' ;
@@ -210,6 +211,7 @@ class ScreenController {
210
211
pageArgs: nextArgs,
211
212
transition: action.transition,
212
213
isExternal: action.isExternal,
214
+ asExternal: action.asExternal,
213
215
);
214
216
215
217
if (action is NavigateScreenAction && action.onNavigateBack != null ) {
@@ -665,7 +667,7 @@ class ScreenController {
665
667
SystemStorageBindingSource (key, storagePrefix: storagePrefix), value));
666
668
}
667
669
668
- /// Navigate to another screen
670
+ /// Navigate to another
669
671
/// [screenName] - navigate to the screen if specified, otherwise to appHome
670
672
/// [asModal] - shows the App in a regular or modal screen
671
673
/// [replace] - whether to replace the current route on the stack, such that
@@ -680,6 +682,7 @@ class ScreenController {
680
682
Map <String , dynamic >? pageArgs,
681
683
Map <String , dynamic >? transition,
682
684
bool isExternal = false ,
685
+ bool asExternal = false ,
683
686
}) {
684
687
PageType pageType = asModal == true ? PageType .modal : PageType .regular;
685
688
@@ -715,11 +718,24 @@ class ScreenController {
715
718
);
716
719
// push the new route and remove all existing screens. This is suitable for logging out.
717
720
if (routeOption == RouteOption .clearAllScreens) {
718
- Navigator .pushAndRemoveUntil (context, route, (route) => false );
721
+ if (asExternal) {
722
+ externalAppNavigateKey? .currentState
723
+ ? .pushAndRemoveUntil (route, (route) => false );
724
+ } else {
725
+ Navigator .pushAndRemoveUntil (context, route, (route) => false );
726
+ }
719
727
} else if (routeOption == RouteOption .replaceCurrentScreen) {
720
- Navigator .pushReplacement (context, route);
728
+ if (asExternal) {
729
+ externalAppNavigateKey? .currentState? .pushReplacement (route);
730
+ } else {
731
+ Navigator .pushReplacement (context, route);
732
+ }
721
733
} else {
722
- Navigator .push (context, route);
734
+ if (asExternal) {
735
+ externalAppNavigateKey? .currentState? .push (route);
736
+ } else {
737
+ Navigator .push (context, route);
738
+ }
723
739
}
724
740
return route;
725
741
}
0 commit comments