setAnimation method
void
setAnimation()
Implementation
void setAnimation() {
// dropdown height
_animationController = AnimationController(
duration: au.isAnimation(
status: widget.isAnimation, duration: Duration(milliseconds: 100)),
vsync: this,
);
_triangleController = AnimationController(
duration: au.isAnimation(
status: widget.isAnimation, duration: Duration(milliseconds: 50)),
vsync: this,
);
Animation<double> curve =
CurvedAnimation(parent: _animationController, curve: Curves.easeIn);
animateHeight =
Tween<double>(begin: 0, end: widget.dropdownHeight).animate(curve);
triangleAnimation = CurvedAnimation(
parent: _triangleController,
curve: Curves.easeIn,
);
// each of items animation
for (var i = 0; i < widget.dropdownIsSelected.length; i++) {
AnimationController animationControllerElement = AnimationController(
vsync: this,
duration: au.isAnimation(
status: widget.isAnimation,
duration: Duration(milliseconds: 300)));
_DCController.add(
animationControllerElement); // selected, unselected decorationBox, textStyle
_paddingController.add(animationControllerElement);
_paddingAnimation.add(EdgeInsetsTween(
begin: widget.dropdownItemPadding,
end: widget.selectedItemPadding)
.animate(CurvedAnimation(
parent: _paddingController[i], curve: Curves.easeIn)));
}
selectedDecorationTween = DecorationTween(
begin: BoxDecoration(color: Colors.transparent),
end: widget.selectedItemBD);
selectedTSTween = TextStyleTween(
begin: widget.unselectedItemTS, end: widget.selectedItemTS);
}