popNavigator method
dynamic
popNavigator(
Implementation
popNavigator(BuildContext context, [bool useRootNavigator = false]) {
Tools.closeAllDialogs();
Tools.closeAllFloating();
if (context.mounted) {
final navigator = Navigator.of(context);
if (navigator.canPop()) {
TCICLog.info(
'popNavigator: canPop',
actionModule: ActionModule.tcicController.name,
actionName: ActionName.popNavigator.name,
);
setIsTCICDestroy(true);
navigator.pop();
} else {
TCICLog.info(
'popNavigator: can not pop',
actionModule: ActionModule.tcicController.name,
actionName: ActionName.popNavigator.name,
);
}
} else {
if (_rootContext != null) {
final navigator = Navigator.of(_rootContext!);
if (navigator.canPop()) {
TCICLog.info(
'popNavigator: canPop',
actionModule: ActionModule.tcicController.name,
actionName: ActionName.popNavigator.name,
);
setIsTCICDestroy(true);
navigator.pop();
} else {
TCICLog.info(
'popNavigator: can not pop',
actionModule: ActionModule.tcicController.name,
actionName: ActionName.popNavigator.name,
);
}
} else {
TCICLog.error(
"rootContext is null",
actionModule: ActionModule.tcicController.name,
actionName: ActionName.popNavigator.name,
);
// 获取当前栈顶的context
}
}
_eventbus.fire(MainEvent(type: EventTypeEnum.pagePop));
}