Skip to content
Merged
Changes from 2 commits
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
13 changes: 11 additions & 2 deletions packages/animations/lib/src/open_container.dart
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ class OpenContainer extends StatefulWidget {
borderRadius: BorderRadius.all(Radius.circular(4.0)),
),
this.openShape = const RoundedRectangleBorder(),
this.onClosed,
@required this.closedBuilder,
@required this.openBuilder,
this.tappable = true,
Expand Down Expand Up @@ -163,6 +164,9 @@ class OpenContainer extends StatefulWidget {
/// * [Material.shape], which is used to implement this property.
final ShapeBorder openShape;

/// Called when the container was popped and has returned to the closed state
Comment thread
The-Redhat marked this conversation as resolved.
Outdated
final VoidCallback onClosed;

/// Called to obtain the child for the container in the closed state.
///
/// The [Widget] returned by this builder is faded out when the container
Expand Down Expand Up @@ -220,8 +224,8 @@ class _OpenContainerState extends State<OpenContainer> {
// same widget included in the [_OpenContainerRoute] where it fades out.
final GlobalKey _closedBuilderKey = GlobalKey();

void openContainer() {
Navigator.of(context).push(_OpenContainerRoute(
Future<void> openContainer<T>() async {
await Navigator.of(context).push(_OpenContainerRoute(
closedColor: widget.closedColor,
openColor: widget.openColor,
closedElevation: widget.closedElevation,
Expand All @@ -235,6 +239,9 @@ class _OpenContainerState extends State<OpenContainer> {
transitionDuration: widget.transitionDuration,
transitionType: widget.transitionType,
));
if (widget.onClosed != null){
widget.onClosed();
}
}

@override
Expand Down Expand Up @@ -287,6 +294,7 @@ class _HideableState extends State<_Hideable> {
/// When non-null the child is replaced by a [SizedBox] of the set size.
Size get placeholderSize => _placeholderSize;
Size _placeholderSize;

Comment thread
The-Redhat marked this conversation as resolved.
Outdated
set placeholderSize(Size value) {
if (_placeholderSize == value) {
return;
Expand All @@ -302,6 +310,7 @@ class _HideableState extends State<_Hideable> {
/// (i.e. [isInTree] returns false).
bool get isVisible => _visible;
bool _visible = true;

Comment thread
The-Redhat marked this conversation as resolved.
Outdated
set isVisible(bool value) {
assert(value != null);
if (_visible == value) {
Expand Down