Visitar URL original
[animations] add routeSettings option to OpenContainer (test included) by britannio · Pull Request #240 · flutter/packages · GitHub
Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
[animations] add routeSettings parameter to OpenContainer
  • Loading branch information
britannio committed Nov 4, 2020
commit 0a9d5c17625dd583c141db363d8766d966a5f202
9 changes: 8 additions & 1 deletion packages/animations/lib/src/open_container.dart
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ class OpenContainer<T extends Object> extends StatefulWidget {
this.transitionDuration = const Duration(milliseconds: 300),
this.transitionType = ContainerTransitionType.fade,
this.useRootNavigator = false,
this.routeSettings,
}) : assert(closedColor != null),
assert(openColor != null),
assert(closedElevation != null),
Expand Down Expand Up @@ -257,6 +258,9 @@ class OpenContainer<T extends Object> extends StatefulWidget {
/// to the nearest navigator.
final bool useRootNavigator;

/// Provides additional data to the [openBuilder] route pushed by the Navigator.
final RouteSettings routeSettings;

@override
_OpenContainerState<T> createState() => _OpenContainerState<T>();
}
Expand Down Expand Up @@ -295,6 +299,7 @@ class _OpenContainerState<T> extends State<OpenContainer<T>> {
transitionDuration: widget.transitionDuration,
transitionType: widget.transitionType,
useRootNavigator: widget.useRootNavigator,
routeSettings: widget.routeSettings,
));
if (widget.onClosed != null) {
widget.onClosed(data);
Expand Down Expand Up @@ -409,6 +414,7 @@ class _OpenContainerRoute<T> extends ModalRoute<T> {
@required this.transitionDuration,
@required this.transitionType,
@required this.useRootNavigator,
@required RouteSettings routeSettings,
}) : assert(closedColor != null),
assert(openColor != null),
assert(closedElevation != null),
Expand All @@ -435,7 +441,8 @@ class _OpenContainerRoute<T> extends ModalRoute<T> {
middleColor: middleColor,
),
_closedOpacityTween = _getClosedOpacityTween(transitionType),
_openOpacityTween = _getOpenOpacityTween(transitionType);
_openOpacityTween = _getOpenOpacityTween(transitionType),
super(settings: routeSettings);

static _FlippableTweenSequence<Color> _getColorTween({
@required ContainerTransitionType transitionType,
Expand Down