add custom animation curve param to expandable.dart

This commit is contained in:
julian 2023-02-27 17:25:37 -06:00
parent d07906c4a7
commit e3dbc64f17
2 changed files with 5 additions and 1 deletions

View file

@ -46,6 +46,8 @@ class _ExpandingSubListItemState extends State<ExpandingSubListItem> {
@override
Widget build(BuildContext context) {
return Expandable(
animationDurationMultiplier: 0.1 * widget.entities.length,
curve: Curves.easeInOutCubicEmphasized,
controller: _controller,
onExpandChanged: (state) {
setState(() {

View file

@ -21,6 +21,7 @@ class Expandable extends StatefulWidget {
this.onExpandChanged,
this.controller,
this.expandOverride,
this.curve = Curves.easeInOut,
}) : super(key: key);
final Widget header;
@ -31,6 +32,7 @@ class Expandable extends StatefulWidget {
final void Function(ExpandableState)? onExpandChanged;
final ExpandableController? controller;
final VoidCallback? expandOverride;
final Curve curve;
@override
State<Expandable> createState() => _ExpandableState();
@ -73,7 +75,7 @@ class _ExpandableState extends State<Expandable> with TickerProviderStateMixin {
animation = widget.animation ??
Tween<double>(begin: 0.0, end: 1.0).animate(
CurvedAnimation(
curve: Curves.easeInOut,
curve: widget.curve,
parent: animationController,
),
);