initialize method
void
initialize({})
Implementation
void initialize(
{double roundedContainerHightt = 170,
required double recordButtonSizeInit,
double recordButtonScaleInit = 1.9,
double roundedContainerWidhdInit = 55,
required Color lockColorFirst,
required Color lockColorSecond}) {
roundedContainerHight = roundedContainerHightt;
recordButtonScale = recordButtonScaleInit;
roundedContainerWidth = roundedContainerWidhdInit;
onHorizontalButtonScale.value = recordButtonScale;
recordButtonSize = recordButtonSizeInit;
lockValue = -(roundedContainerHightt - 50).toDouble();
_animationController = AnimationController(
duration: Duration(milliseconds: 350),
vsync: this,
);
_roundedVerticalContainerController = AnimationController(
duration: Duration(milliseconds: 200),
vsync: this,
);
_slideUpParIconArrowUpAnimationController = AnimationController(
duration: Duration(milliseconds: 300),
vsync: this,
);
_roundedVerticalContainerControllerHight = AnimationController(
duration: Duration(milliseconds: 700),
vsync: this,
);
micFadeController = AnimationController(
duration: Duration(milliseconds: 300),
vsync: this,
);
shackleAnimationController = AnimationController(
duration: Duration(milliseconds: 700),
vsync: this,
);
shackleAnimation = Tween<double>(
begin: (roundedContainerWidth * 0.3),
end: (roundedContainerWidth * 0.3) * 0.6)
.animate(CurvedAnimation(
parent: shackleAnimationController,
curve: Curves.easeInOut,
));
micFadeAnimation = Tween<double>(begin: 1.0, end: 0.0).animate(
CurvedAnimation(parent: micFadeController, curve: Curves.easeInCubic));
_roundedVerticalContainerAnimationHight = Tween<double>(
begin: roundedContainerHight,
end: roundedContainerHight + 10,
).animate(CurvedAnimation(
parent: _roundedVerticalContainerControllerHight,
curve: Curves.easeInOut,
));
_scaleAnimation = Tween<double>(
begin: 1.0,
end: recordButtonScale,
).chain(CurveTween(curve: Curves.elasticInOut)).animate(
_animationController,
// curve: Curves.easeInOut,
);
_roundedVerticalContainerAnimation = Tween<double>(
begin: 1.0,
end: 1.6,
).animate(CurvedAnimation(
parent: _roundedVerticalContainerController,
curve: Curves.easeInOut,
));
_slideUpParIconArrowUpAnimation =
Tween<double>(begin: -10, end: 10).animate(CurvedAnimation(
parent: _slideUpParIconArrowUpAnimationController,
curve: Curves.easeInOut,
));
colorController =
AnimationController(vsync: this, duration: Duration(milliseconds: 500));
colorAnimation = ColorTween(begin: lockColorFirst, end: lockColorSecond)
.animate(CurvedAnimation(
parent: colorController, curve: Curves.easeInOutCubicEmphasized));
_roundedVerticalContainerController.addStatusListener(
(status) {
if (status == AnimationStatus.dismissed &&
!_roundedVerticalContainerController.isAnimating) {
roundedContainerVal.value = 0;
isMoving.value = false;
_roundedVerticalContainerController.reverse();
shouldStartVisualizer.value = true;
}
},
);
}