mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-27 17:29:50 +08:00
RepoList: Use a better curve
This makes the entire animation look so much better.
This commit is contained in:
@ -40,8 +40,14 @@ class _AppDrawerState extends State<AppDrawer>
|
|||||||
AnimationController(duration: 250.milliseconds, vsync: this);
|
AnimationController(duration: 250.milliseconds, vsync: this);
|
||||||
|
|
||||||
slideAnimation = Tween(begin: const Offset(0.0, -0.5), end: Offset.zero)
|
slideAnimation = Tween(begin: const Offset(0.0, -0.5), end: Offset.zero)
|
||||||
.animate(animController);
|
.animate(CurvedAnimation(
|
||||||
sizeAnimation = Tween(begin: 0.0, end: 1.0).animate(animController);
|
parent: animController,
|
||||||
|
curve: standardEasing,
|
||||||
|
));
|
||||||
|
sizeAnimation = Tween(begin: 0.0, end: 1.0).animate(CurvedAnimation(
|
||||||
|
parent: animController,
|
||||||
|
curve: standardEasing,
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -91,6 +91,7 @@ class _CurrentRepo extends StatefulWidget {
|
|||||||
|
|
||||||
class __CurrentRepoState extends State<_CurrentRepo>
|
class __CurrentRepoState extends State<_CurrentRepo>
|
||||||
with SingleTickerProviderStateMixin {
|
with SingleTickerProviderStateMixin {
|
||||||
|
Animation _animation;
|
||||||
AnimationController controller;
|
AnimationController controller;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -98,6 +99,10 @@ class __CurrentRepoState extends State<_CurrentRepo>
|
|||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
controller = AnimationController(duration: 250.milliseconds, vsync: this);
|
controller = AnimationController(duration: 250.milliseconds, vsync: this);
|
||||||
|
_animation = Tween(begin: 0.0, end: 0.5).animate(CurvedAnimation(
|
||||||
|
parent: controller,
|
||||||
|
curve: Curves.linear,
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -122,7 +127,7 @@ class __CurrentRepoState extends State<_CurrentRepo>
|
|||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
),
|
),
|
||||||
RotationTransition(
|
RotationTransition(
|
||||||
turns: Tween(begin: 0.0, end: 0.5).animate(controller),
|
turns: _animation,
|
||||||
child: IconButton(
|
child: IconButton(
|
||||||
icon: const FaIcon(FontAwesomeIcons.angleDown),
|
icon: const FaIcon(FontAwesomeIcons.angleDown),
|
||||||
onPressed: _pressed,
|
onPressed: _pressed,
|
||||||
@ -142,7 +147,7 @@ class __CurrentRepoState extends State<_CurrentRepo>
|
|||||||
|
|
||||||
void _pressed() {
|
void _pressed() {
|
||||||
if (controller.isCompleted) {
|
if (controller.isCompleted) {
|
||||||
controller.reverse(from: 0.0);
|
controller.reverse(from: 1.0);
|
||||||
} else {
|
} else {
|
||||||
controller.forward(from: 0.0);
|
controller.forward(from: 0.0);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user