RepoList: Use a better curve

This makes the entire animation look so much better.
This commit is contained in:
Vishesh Handa
2021-02-04 17:23:32 +01:00
parent 07b6c6e099
commit bff9162858
2 changed files with 15 additions and 4 deletions

View File

@ -40,8 +40,14 @@ class _AppDrawerState extends State<AppDrawer>
AnimationController(duration: 250.milliseconds, vsync: this);
slideAnimation = Tween(begin: const Offset(0.0, -0.5), end: Offset.zero)
.animate(animController);
sizeAnimation = Tween(begin: 0.0, end: 1.0).animate(animController);
.animate(CurvedAnimation(
parent: animController,
curve: standardEasing,
));
sizeAnimation = Tween(begin: 0.0, end: 1.0).animate(CurvedAnimation(
parent: animController,
curve: standardEasing,
));
}
@override

View File

@ -91,6 +91,7 @@ class _CurrentRepo extends StatefulWidget {
class __CurrentRepoState extends State<_CurrentRepo>
with SingleTickerProviderStateMixin {
Animation _animation;
AnimationController controller;
@override
@ -98,6 +99,10 @@ class __CurrentRepoState extends State<_CurrentRepo>
super.initState();
controller = AnimationController(duration: 250.milliseconds, vsync: this);
_animation = Tween(begin: 0.0, end: 0.5).animate(CurvedAnimation(
parent: controller,
curve: Curves.linear,
));
}
@override
@ -122,7 +127,7 @@ class __CurrentRepoState extends State<_CurrentRepo>
crossAxisAlignment: CrossAxisAlignment.start,
),
RotationTransition(
turns: Tween(begin: 0.0, end: 0.5).animate(controller),
turns: _animation,
child: IconButton(
icon: const FaIcon(FontAwesomeIcons.angleDown),
onPressed: _pressed,
@ -142,7 +147,7 @@ class __CurrentRepoState extends State<_CurrentRepo>
void _pressed() {
if (controller.isCompleted) {
controller.reverse(from: 0.0);
controller.reverse(from: 1.0);
} else {
controller.forward(from: 0.0);
}