spine-runtimes/spine-flutter/example/lib/debug_rendering.dart
2023-02-17 11:38:40 +01:00

24 lines
775 B
Dart

import 'package:spine_flutter/spine_flutter.dart';
import 'package:flutter/material.dart';
class DebugRendering extends StatelessWidget {
const DebugRendering({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
reportLeaks();
const debugRenderer = DebugRenderer();
final controller = SpineWidgetController(onInitialized: (controller) {
controller.animationState.setAnimationByName(0, "walk", true);
}, onAfterPaint: (controller, canvas, commands) {
debugRenderer.render(controller.drawable, canvas, commands);
});
return Scaffold(
appBar: AppBar(title: const Text('Debug Renderer')),
body: SpineWidget.fromAsset("assets/spineboy.atlas", "assets/spineboy-pro.skel", controller),
);
}
}