simple_animation.dart 1.0 KB

12345678910111213141516171819202122
  1. import 'package:spine_flutter/spine_flutter.dart';
  2. import 'package:flutter/material.dart';
  3. class SimpleAnimation extends StatelessWidget {
  4. const SimpleAnimation({Key? key}) : super(key: key);
  5. @override
  6. Widget build(BuildContext context) {
  7. reportLeaks();
  8. final controller = SpineWidgetController(onInitialized: (controller) {
  9. // Set the walk animation on track 0, let it loop
  10. controller.animationState.setAnimationByName(0, "walk", true);
  11. });
  12. return Scaffold(
  13. appBar: AppBar(title: const Text('Simple Animation')),
  14. body: SpineWidget.asset("assets/spineboy.atlas", "assets/spineboy-pro.skel", controller),
  15. // body: SpineWidget.file( "/Users/badlogic/workspaces/spine-runtimes/examples/spineboy/export/spineboy.atlas", "/Users/badlogic/workspaces/spine-runtimes/examples/spineboy/export/spineboy-pro.skel", controller),
  16. // body: const SpineWidget.http("https://marioslab.io/dump/spineboy/spineboy.atlas", "https://marioslab.io/dump/spineboy/spineboy-pro.json"),
  17. );
  18. }
  19. }