@@ -75,7 +75,7 @@ class NavigationIndicatorState<T extends NavigationIndicator> extends State<T> {
7575 }
7676
7777 bool get isSelected {
78- return pane.isSelected (pane.effectiveItems[itemIndex] );
78+ return pane.isSelected (item );
7979 }
8080
8181 Axis get axis {
@@ -94,15 +94,17 @@ class NavigationIndicatorState<T extends NavigationIndicator> extends State<T> {
9494 return InheritedNavigationView .of (context).oldIndex;
9595 }
9696
97+ PaneItem get item {
98+ return pane.effectiveItems[itemIndex];
99+ }
100+
97101 /// The parent of this item, if any
98102 PaneItemExpander ? get parent {
99- final items = InheritedNavigationView . of (context). pane! .effectiveItems;
103+ final items = pane.effectiveItems;
100104
101105 final expandableItems = items.whereType <PaneItemExpander >();
102106 if (expandableItems.isEmpty) return null ;
103107
104- final item =
105- InheritedNavigationView .of (context).pane! .effectiveItems[itemIndex];
106108 for (final expandable in expandableItems) {
107109 if (expandable.items.contains (item)) return expandable;
108110 }
@@ -256,9 +258,17 @@ class _StickyNavigationIndicatorState
256258 return ;
257259 }
258260
259- _old = PageStorage .of (context)? .readState (context) as int ? ?? _old;
261+ _old = (PageStorage .of (context)? .readState (
262+ context,
263+ identifier: 'oldIndex$itemIndex ' ,
264+ ) as num ? )
265+ ? .toInt () ??
266+ _old;
260267
261- if (_old == oldIndex) return ;
268+ // do not perform the animation twice
269+ if (_old == oldIndex) {
270+ return ;
271+ }
262272
263273 if (isShowing) {
264274 if (isBelow) {
@@ -300,7 +310,11 @@ class _StickyNavigationIndicatorState
300310
301311 _old = oldIndex;
302312 if (mounted) {
303- PageStorage .of (context)? .writeState (context, _old);
313+ PageStorage .of (context)? .writeState (
314+ context,
315+ _old,
316+ identifier: 'oldIndex$itemIndex ' ,
317+ );
304318 setState (() {});
305319 }
306320 }
0 commit comments