diff --git a/sky/sdk/lib/widgets/navigator.dart b/sky/sdk/lib/widgets/navigator.dart index 03d8c3bf915dab863ea4d3e5169a5516d1f7c0a7..99b5b87171d23167da43ad865e03d75a3700f0c5 100644 --- a/sky/sdk/lib/widgets/navigator.dart +++ b/sky/sdk/lib/widgets/navigator.dart @@ -130,8 +130,9 @@ class Transition extends AnimatedComponent { } class HistoryEntry { - HistoryEntry(this.route); + HistoryEntry({ this.route, this.key }); final RouteBase route; + final int key; // TODO(jackson): Keep track of the requested transition } @@ -142,11 +143,12 @@ class NavigationState { if (route.name != null) namedRoutes[route.name] = route; } - history.add(new HistoryEntry(routes[0])); + history.add(new HistoryEntry(route: routes[0], key: _lastKey++)); } List history = new List(); int historyIndex = 0; + int _lastKey = 0; Map namedRoutes = new Map(); RouteBase get currentRoute => history[historyIndex].route; @@ -159,7 +161,7 @@ class NavigationState { } void push(RouteBase route) { - HistoryEntry historyEntry = new HistoryEntry(route); + HistoryEntry historyEntry = new HistoryEntry(route: route, key: _lastKey++); history.insert(historyIndex + 1, historyEntry); historyIndex++; } @@ -224,9 +226,8 @@ class Navigator extends StatefulComponent { } if (content == null) continue; - String key = historyEntry.route.key; Transition transition = new Transition( - key: key, + key: historyEntry.key.toString(), content: content, direction: (i <= state.historyIndex) ? TransitionDirection.forward : TransitionDirection.reverse, interactive: (i == state.historyIndex),