fromValueListenable<T> static method
Widget
fromValueListenable<T>({
- Key? key,
- bool maintainHistory = false,
- required ValueListenable<
T> valueListenable, - int? getDepth(
- T value
- List<
ValueHistoryEntry< ? initialHistory,T> > - required AnimatedValueWidgetBuilder<
T> builder, - RouteTransitionsBuilder transitionsBuilder = defaultRouteTransitionsBuilder,
- Duration transitionDuration = _kDefaultTransitionDuration,
- required void onPop(
- T,
- T
- bool takeFocus = false,
- bool maintainState = true,
- bool opaque = true,
- int? popPriority,
Creates an ImplicitNavigator that pushes new pages when the
valueListenable
changes and calls onPop
when pages are popped.
This is a convenience method on top of selectFromListenable.
If non-null, getDepth
will 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
static Widget fromValueListenable<T>({
Key? key,
bool maintainHistory = false,
required ValueListenable<T> valueListenable,
int? Function(T value)? getDepth,
List<ValueHistoryEntry<T>>? initialHistory,
required AnimatedValueWidgetBuilder<T> builder,
RouteTransitionsBuilder transitionsBuilder = defaultRouteTransitionsBuilder,
Duration transitionDuration = _kDefaultTransitionDuration,
required void Function(T, T) onPop,
bool takeFocus = false,
bool maintainState = true,
bool opaque = true,
int? popPriority,
}) {
return selectFromListenable<ValueListenable<T>, T>(
key: key,
maintainHistory: maintainHistory,
listenable: valueListenable,
selector: () => valueListenable.value,
getDepth: getDepth,
initialHistory: initialHistory,
builder: builder,
transitionsBuilder: transitionsBuilder,
transitionDuration: transitionDuration,
onPop: onPop,
takeFocus: takeFocus,
maintainState: maintainState,
opaque: opaque,
popPriority: popPriority,
);
}