CustomSwitch icon indicating copy to clipboard operation
CustomSwitch copied to clipboard

It should be stateless

Open ghost opened this issue 5 years ago • 5 comments

Since this is a generic widget, it should be stateless.

ghost avatar Dec 26 '19 18:12 ghost

Apparently you can't add SingleTickerProviderStateMixin to StatelessWidget. image

georgiani avatar May 15 '20 15:05 georgiani

Dont

ghost avatar May 15 '20 15:05 ghost

It's needed for the animation to work. Is there any alternative?

georgiani avatar May 15 '20 16:05 georgiani

Sucks that Animation needs it. But there must be another way. This is a flaw.

ghost avatar May 15 '20 18:05 ghost

It is an explicit animation and it works like that, because the animation should be notified at every tick of the Ticker that is mixed with the widget. Another way I think it could work is by using one of the Implicit Animations widget, such as AnimatedAlign and using a scoped model or something else. But there is another problem. If you try an animatedAlign it won't seem animated because the Text widgets just appear out of nowhere, so.. to do that I would have to rewrite nearly everything

georgiani avatar May 15 '20 19:05 georgiani