main.dart 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import 'package:flutter/material.dart';
  2. import 'package:spine_flutter/spine_flutter.dart';
  3. class ExampleSelector extends StatelessWidget {
  4. @override
  5. Widget build(BuildContext context) {
  6. const spacer = SizedBox(height: 10);
  7. return Scaffold(
  8. appBar: AppBar(title: const Text('Spine Examples')),
  9. body: Center(
  10. child: Column(
  11. mainAxisSize: MainAxisSize.min,
  12. children: [
  13. ElevatedButton(
  14. child: const Text('Spineboy'),
  15. onPressed: () {
  16. Navigator.push(
  17. context,
  18. MaterialPageRoute<void>(
  19. builder: (context) => const Spineboy(),
  20. ),
  21. );
  22. },
  23. ),
  24. spacer
  25. ]
  26. )
  27. )
  28. );
  29. }
  30. }
  31. class Spineboy extends StatelessWidget {
  32. const Spineboy({Key? key}) : super(key: key);
  33. @override
  34. Widget build(BuildContext context) {
  35. return Scaffold(
  36. appBar: AppBar(title: const Text('Spineboy')),
  37. body: const SpineWidget.asset("assets/spineboy-pro.skel", "assets/spineboy.atlas"),
  38. // body: const SpineWidget.file("/Users/badlogic/workspaces/spine-runtimes/examples/spineboy/export/spineboy-pro.skel", "/Users/badlogic/workspaces/spine-runtimes/examples/spineboy/export/spineboy.atlas"),
  39. // body: const SpineWidget.http("https://marioslab.io/dump/spineboy/spineboy-pro.json", "https://marioslab.io/dump/spineboy/spineboy.atlas"),
  40. );
  41. }
  42. }
  43. void main() {
  44. runApp(MaterialApp(
  45. title: "Spine Examples",
  46. home: ExampleSelector()
  47. ));
  48. }