Created
December 16, 2019 19:51
-
-
Save she-who-codes/85d8f0da97abfc3ecc43b1cb470e9c29 to your computer and use it in GitHub Desktop.
This file contains 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:flutter/material.dart'; | |
import 'package:flare_flutter/flare_actor.dart'; | |
import 'package:flare_flutter/flare_controls.dart'; | |
import 'AnimationController.dart'; | |
class HomePage extends StatefulWidget { | |
@override | |
HomePageState createState() => new HomePageState(); | |
} | |
class HomePageState extends State<HomePage> { | |
CustomAnimationController _animationController = CustomAnimationController(); | |
bool isSpin = false; | |
void initState() { | |
super.initState(); | |
} | |
void _playOther() { | |
setState(() { | |
_animationController.playAnim(); | |
}); | |
} | |
@override | |
void dispose() { | |
super.dispose(); | |
} | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
backgroundColor: const Color.fromRGBO(93, 93, 93, 1), | |
body: Container( | |
///Stack some widgets | |
color: const Color.fromRGBO(93, 93, 93, 1), | |
child: Stack( | |
fit: StackFit.expand, | |
children: [ | |
///this is our main artboard | |
FlareActor( | |
"assets/test.flr", | |
controller: _animationController, | |
fit: BoxFit.contain, | |
artboard: "Artboard", | |
), | |
MaterialButton( | |
child: Text('Play Diff Anim'), | |
onPressed: _playOther, | |
) | |
], | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment