浏览代码

Merge pull request #146 from Unity-Technologies/zgh/fix/navigation

fix navigation error
/main
GitHub 4 年前
当前提交
3a76a6d5
共有 1 个文件被更改,包括 50 次插入0 次删除
  1. 50
      com.unity.uiwidgets/Runtime/widgets/navigator.cs

50
com.unity.uiwidgets/Runtime/widgets/navigator.cs


return of(context).pushReplacementNamed<T,TO>(routeName, arguments: arguments,result: result);
}
public static Future pushReplacementNamed(BuildContext context, string routeName,
object result = default , object arguments = null) {
return of(context).pushReplacementNamed(routeName, arguments: arguments,result: result);
}
public static Future<T> popAndPushNamed<T,TO>(BuildContext context, string routeName,
TO result = default,
object arguments = null) {

return pushReplacement<T, TO>(_routeNamed<T>(routeName, arguments: arguments), result: result);
}
public Future pushReplacementNamed(
string routeName,
object result = default,
object arguments = null
) {
return pushReplacement(_routeNamed(routeName, arguments: arguments), result: result);
}
public Future<T> popAndPushNamed<T, TO>(
string routeName,
TO result = default,

_afterNavigation(newRoute);
return newRoute.popped.to<T>();
}
public Future pushReplacement(Route newRoute, object result) {
D.assert(!_debugLocked);
D.assert(() => {
_debugLocked = true;
return true;
});
D.assert(newRoute != null);
D.assert(newRoute._navigator == null);
D.assert(_history.isNotEmpty());
bool anyEntry = false;
foreach (var historyEntry in _history) {
if (_RouteEntry.isPresentPredicate(historyEntry)) {
anyEntry = true;
}
}
D.assert(anyEntry,()=> "Navigator has no active routes to replace.");
_RouteEntry lastEntry = null;
foreach (var historyEntry in _history) {
if (_RouteEntry.isPresentPredicate(historyEntry)) {
lastEntry = historyEntry;
}
}
lastEntry.complete(result, isReplaced: true);
_history.Add(new _RouteEntry(newRoute, initialState: _RouteLifecycle.pushReplace));
_flushHistoryUpdates();
D.assert(() => {
_debugLocked = false;
return true;
});
_afterNavigation(newRoute);
return newRoute.popped.to<object>();
}
public Future<T> pushAndRemoveUntil<T>(Route<T> newRoute, RoutePredicate predicate) {
D.assert(!_debugLocked);

正在加载...
取消
保存