React hooks for Flutter. Hooks are a new kind of object that manages a Widget life-cycles. They are used to increase code sharing between widgets and as a complete replacement for StatefulWidget.
MIT License
3.07k
stars
175
forks
source link
animation value was not got as expect when use `controller.reverse()` #355
the animation.value was not get as expected when reverse() was called.
The value should change smoothly from 1 to 0. But currently the got only limited values which are closed to 1
To Reproduce
class DemoAnimation extends HookWidget {
const DemoAnimation({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
final ticker = useSingleTickerProvider();
final controller = useAnimationController(
vsync: ticker,
duration: const Duration(seconds: 1),
);
final a = Tween<double>(begin: 0, end: 1).animate(controller)
..addStatusListener((status) {
if (status == AnimationStatus.completed) {
controller.reverse();
} else if (status == AnimationStatus.dismissed) {
controller.forward();
}
});
final o = useAnimation(a);
controller.forward();
print("o: $o");
return Opacity(
opacity: o,
child: Container(
margin: const EdgeInsets.symmetric(vertical: 2),
width: 6,
height: 12,
color: Colors.black,
),
);
}
}
Describe the bug
the animation.value was not get as expected when
reverse()
was called. The value should change smoothly from 1 to 0. But currently the got only limited values which are closed to 1To Reproduce
Expected behavior
animation value would be got as expected.