flutter_animate
flutter_animate copied to clipboard
[Question] Why is this behaviour happening?
Hi, awesome library!
I have a widget that is like a checkbox. And I wanted to use scale effect, when is checked, the Check icon scales to 1.8, and when is unchecked, it scales down to 0. I created a StatelessWidget, passed the offset values as something like Offset(x: active? 1.8 : 0)...,
and target: active ? 1 : 0b But the animation would only run when I tapped the button and active was true.
So I created a StatefulWidget and this is my animate:
target: widget.active ? 1 : 0,
effects: [
ScaleEffect(
duration: .4.seconds,
curve: Curves.easeInOut,
begin: Offset.zero,
end: const Offset(
1.8,
1.8,
),
),
],
child: Icon(
Icons.check,
color: widget.active ? context.surface : context.onSurface,
size: 12,
),
),
I didn't specify a the scale down effect, but when active is false, the animation is running backwards, so it is scalling down as i wanted. It's great that it's working but i don't really understand why.