reveal method
Implementation
void reveal(RevealSide direction) {
// can only reveal when showing main
if (translate != 0) {
return;
}
final mediaWidth = MediaQuery
.of(context)
.size
.width;
final multiplier = (direction == RevealSide.left ? 1 : -1);
final goal = _calculateGoal(mediaWidth, multiplier);
final animationController = AnimationController(
vsync: this, duration: const Duration(milliseconds: 200));
animationController.addStatusListener((status) {
if (status == AnimationStatus.completed) {
_onApplyTranslation();
animationController.dispose();
}
});
final animation =
Tween<double>(begin: translate, end: goal).animate(animationController);
animation.addListener(() {
setState(() {
translate = animation.value;
});
});
animationController.forward();
}