marquee
marquee copied to clipboard
Reset the animation programatically
Is there any way to reset the animation of the text programatically?
Currently, not that I know of.
In the meantime, you can pass a key
and change it, which should cause the widget to rebuild from the initial state.
Currently, not that I know of. In the meantime, you can pass a
key
and change it, which should cause the widget to rebuild from the initial state.
I spend alot of time to reset animation to initial state. finally, your answer hint me to do it. Thanks, That is how I manage it. may be helpful for someone.
Key _refreshKey = UniqueKey();
void _handleLocalChanged() => setState((){
_refreshKey = UniqueKey()
});
Widget build(BuildContext context){
return MaterialApp(
key: _refreshKey ,
...
)
}
Currently, not that I know of. In the meantime, you can pass a
key
and change it, which should cause the widget to rebuild from the initial state.I spend alot of time to reset animation to initial state. finally, your answer hint me to do it. Thanks, That is how I manage it. may be helpful for someone.
Key _refreshKey = UniqueKey(); void _handleLocalChanged() => setState((){ _refreshKey = UniqueKey() }); Widget build(BuildContext context){ return MaterialApp( key: _refreshKey , ... ) }
Problem is, that the startPadding "flashes" when it resets. It becomes 0 for a brief moment.