CustomSwitch
CustomSwitch copied to clipboard
It should be stateless
Since this is a generic widget, it should be stateless.
Apparently you can't add SingleTickerProviderStateMixin to StatelessWidget.

Dont
It's needed for the animation to work. Is there any alternative?
Sucks that Animation needs it. But there must be another way. This is a flaw.
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