• RuntimesBugs
  • spine_flutter: ^ 4.2.33 Running animation exception

  • 編集済み

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 がこの投稿に返信しました。
    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 がこの投稿に返信しました。

      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 がこの投稿に返信しました。

        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 がこの投稿に返信しました。

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

          • Misaki が「いいね」しました。