• RuntimesBugs
  • spine_flutter: ^ 4.2.33 Running animation exception

  • Đã chỉnh sửa

From the callback event, it can be seen that the animation is running, but nothing is displayed on the page and there are no error prompts. What should I do
This is my animation file

jackpot.zip
3MB
  Widget build(BuildContext context) {
    final controller = SpineWidgetController(onInitialized: (controller) {
      // Set the walk animation on track 0, let it loop
      controller.animationState
          .setAnimationByName(0, "jackpot", true)
          .setListener((type, trackEntry, event) {
        print("jackpot animation event $type");
      });
      print(
          "Current: ${controller.animationState.getCurrent(0)?.getAnimation().getName()}");
    });
    return Container(
        width: double.infinity,
        height: 300,
        //color: Colors.blue,
        child: SpineWidget.fromAsset("assets/spine/jackpot.atlas",
            "assets/spine/jackpot.json", controller),
      );
  • Misaki đã trả lời bài viết này.
    Related Discussions
    ...

    cabin Your skeleton is not showing any attachments at all in the setup pose, so maybe the bounding box is not calculated properly and is not being displayed. You might want to define the size to be determined by the parent widget in sizedByBounds. See the SpineWidget section of the documentation for more information:
    https://esotericsoftware.com/spine-flutter#SpineWidget

    • cabin đã trả lời bài viết này.

      Misaki Thank you very much for your reply. I have just started learning it. Can you clearly point out the issues in my code? Thank you.

      • Misaki đã trả lời bài viết này.

        cabin For example, in SpineWidget.fromAsset() you can add optional arguments like this:

                    child: SpineWidget.fromAsset(
                      "assets/spine/jackpot.atlas",
                      "assets/spine/jackpot.json",
                      controller,
                      boundsProvider: SkinAndAnimationBounds(skins: ["default"], animation: "jackpot"),
                      sizedByBounds: true,
                    )
        • cabin đã trả lời bài viết này.

          Misaki Thank you very much. This way, the animation can indeed be displayed

          • Misaki đã thích điều này.