marquee icon indicating copy to clipboard operation
marquee copied to clipboard

Reset the animation programatically

Open TcBello opened this issue 3 years ago • 3 comments

Is there any way to reset the animation of the text programatically?

TcBello avatar Jun 06 '21 08:06 TcBello

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.

MarcelGarus avatar Jun 18 '21 08:06 MarcelGarus

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 ,
      ...
    )
  }

osamasaeed avatar Nov 23 '22 13:11 osamasaeed

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.

triggerfx avatar Aug 10 '24 13:08 triggerfx