mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-21 01:36:02 +08:00
21 lines
669 B
Dart
21 lines
669 B
Dart
import 'package:spine_flutter/spine_flutter.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
class SimpleAnimation extends StatelessWidget {
|
|
const SimpleAnimation({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
reportLeaks();
|
|
final controller = SpineWidgetController(onInitialized: (controller) {
|
|
// Set the walk animation on track 0, let it loop
|
|
controller.animationState.setAnimationByName(0, "walk", true);
|
|
});
|
|
|
|
return Scaffold(
|
|
appBar: AppBar(title: const Text('Simple Animation')),
|
|
body: SpineWidget.fromAsset("assets/spineboy.atlas", "assets/spineboy-pro.skel", controller)
|
|
);
|
|
}
|
|
}
|