Created
          January 6, 2020 15:43 
        
      - 
      
- 
        Save klaszlo8207/82ea215901504ab77ed1f1448bffff82 to your computer and use it in GitHub Desktop. 
    SimpleAnimatedWidget
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import 'package:animator/animator.dart'; | |
| import 'package:flutter/foundation.dart'; | |
| import 'package:flutter/material.dart'; | |
| class SimpleAnimatedWidget extends StatelessWidget { | |
| SimpleAnimatedWidget({ | |
| @required this.child, | |
| @required this.tween, | |
| @required this.builder, | |
| this.curve = Curves.linear, | |
| this.milliseconds = 500, | |
| this.repeats = 1, | |
| this.cycles = 1, | |
| }); | |
| final Widget child; | |
| final Tween tween; | |
| final Function(Animation<dynamic>) builder; | |
| Curve curve = Curves.linear; | |
| int milliseconds = 500; | |
| int repeats = 1; | |
| int cycles = 1; | |
| @override | |
| Widget build(BuildContext context) { | |
| return Animator( | |
| triggerOnInit: true, | |
| resetAnimationOnRebuild: true, | |
| repeats: repeats, | |
| cycles: cycles, | |
| tween: tween, | |
| curve: curve, | |
| duration: Duration(milliseconds: milliseconds), | |
| builder: builder, | |
| ); | |
| } | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment