Skip to content

Support reverseCurve in expansionAnimationStyle of ExpansionTile #146760

@chika3742

Description

@chika3742

Use case

I want to use different curves for expanding and collapsing ExpansionTile, but setting reverseCurve in expansionAnimationStyle doesn't seem to have any effect.

ExpansionTile(
  expansionAnimationStyle: AnimationStyle(
    curve: Curves.easeOutQuint,
    reverseCurve: Curves.easeInQuint, // no effect
  ),
);

Proposal

Please support reverseCurve in expansionAnimationStyle. I think this can be achieved by modifying expansion_tile.dart like this.

  (line 569)
- final CurveTween _heightFactorTween = CurveTween(curve: Curves.easeIn);
+ final Tween<double> _heightFactorTween = Tween<double>(begin: 0.0, end: 1.0);

  (line 573)
- late Animation<double> _heightFactor;
+ late CurvedAnimation _heightFactor;

  (line 587)
- _heightFactor = _animationController.drive(_heightFactorTween);
+ _heightFactor = CurvedAnimation(
+   parent: _animationController.drive(_heightFactorTween),
+   curve: Curves.easeIn,
+ );

  (line 865)
- _heightFactorTween.curve = widget.expansionAnimationStyle?.curve
+ _heightFactor.curve = widget.expansionAnimationStyle?.curve
    ?? expansionTileTheme.expansionAnimationStyle?.curve
    ?? Curves.easeIn;
+ 
+ _heightFactor.reverseCurve = widget.expansionAnimationStyle?.reverseCurve
+   ?? expansionTileTheme.expansionAnimationStyle?.reverseCurve
+   ?? Curves.easeIn;

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work listc: new featureNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to Flutterf: material designflutter/packages/flutter/material repository.frameworkflutter/packages/flutter repository. See also f: labels.team-designOwned by Design Languages teamtriaged-designTriaged by Design Languages teamwaiting for PR to land (fixed)A fix is in flight

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions