Skip to content

Commit

Permalink
callback?
Browse files Browse the repository at this point in the history
  • Loading branch information
wanjawischmeier committed Jun 7, 2023
1 parent 5588c52 commit ec7e19b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/slide_to_act.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class SlideAction extends StatefulWidget {

/// Callback called on submit
/// If this is null the component will not animate to complete
final VoidCallback? onSubmit;
final Future? Function()? onSubmit;

/// Elevation of the component
final double elevation;
Expand Down Expand Up @@ -216,7 +216,11 @@ class SlideActionState extends State<SlideAction>

await _checkAnimation();

widget.onSubmit!();
widget.onSubmit!()?.then((value) {
_resizeAnimationController.reset();
_shrinkAnimationController.reset();
_checkAnimationController.reset();
});
}
},
child: Padding(
Expand Down Expand Up @@ -394,7 +398,7 @@ class SlideActionState extends State<SlideAction>
duration: widget.animationDuration,
);

WidgetsBinding.instance!.addPostFrameCallback((_) {
WidgetsBinding.instance.addPostFrameCallback((_) {
final RenderBox containerBox =
_containerKey.currentContext!.findRenderObject() as RenderBox;
_containerWidth = containerBox.size.width;
Expand Down

0 comments on commit ec7e19b

Please sign in to comment.