ImplicitNavigator<T>.fromNotifier constructor
ImplicitNavigator<T>.fromNotifier ({
- Key? key,
- required ValueNotifier<
T> valueNotifier, - int? getDepth(
- T value
- List<
ValueHistoryEntry< ? initialHistory,T> > - required AnimatedValueWidgetBuilder<
T> builder, - RouteTransitionsBuilder transitionsBuilder = defaultRouteTransitionsBuilder,
- Duration transitionDuration = const Duration(milliseconds: 300),
- void onPop(
- T poppedValue,
- T currentValue
- bool takeFocus = false,
- bool maintainState = true,
- bool opaque = true,
- int? popPriority,
Creates an ImplicitNavigator that pushes new pages when the
valueNotifier
changes and reverts valueNotifier.value
when pages are
popped.
If non-null, getDepth
we be called on each value and used to set
ImplicitNavigator.depth. getDepth
MUST return the same depth for a
given value every time it's called on that value. If it returns
inconsistent depths, ImplicitNavigator may push redundant pages and will
not pop pages properly.
Implementation
ImplicitNavigator.fromNotifier({
this.key,
required ValueNotifier<T> valueNotifier,
int? Function(T value)? getDepth,
this.initialHistory,
required this.builder,
this.transitionsBuilder = defaultRouteTransitionsBuilder,
this.transitionDuration = const Duration(milliseconds: 300),
this.onPop,
this.takeFocus = false,
this.maintainState = true,
this.opaque = true,
this.popPriority,
}) : value = valueNotifier.value,
depth = getDepth?.call(valueNotifier.value),
_valueNotifier = valueNotifier,
_getDepth = getDepth;