gpt4 book ai didi

Flutter Flare 动画无法正常工作

转载 作者:行者123 更新时间:2023-12-04 15:47:38 24 4
gpt4 key购买 nike

我正在尝试让 Flare 动画在 Flutter 中运行。为此,我尝试了这个: https://github.com/tarek360/Boring-Star-Animation

实际上,该代码工作 非常好。但是,我想将动画更改为: https://www.2dimensions.com/a/innocent/files/flare/status_success

现在,代码运行并显示动画,但仍然如此。 (即,不动画,只显示照片)我得到以下错误:

E/flutter ( 7462): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: NoSuchMethodError: The method '*' was called on null.
E/flutter ( 7462): Receiver: null
E/flutter ( 7462): Tried calling: *(0.0)
E/flutter ( 7462): #0 Object.noSuchMethod (dart:core/runtime/libobject_patch.dart:50:5)
E/flutter ( 7462): #1 KeyFrameStrokeEnd.setValue (package:flare_dart/animation/keyframe.dart:1161:33)
E/flutter ( 7462): #2 KeyFrameNumeric.apply (package:flare_dart/animation/keyframe.dart:138:5)
E/flutter ( 7462): #3 PropertyAnimation.apply (package:flare_dart/animation/actor_animation.dart:199:21)
E/flutter ( 7462): #4 ComponentAnimation.apply (package:flare_dart/animation/actor_animation.dart:248:27)
E/flutter ( 7462): #5 ActorAnimation.apply (package:flare_dart/animation/actor_animation.dart:403:26)
E/flutter ( 7462): #6 FlareActorRenderObject._updateAnimation (package:flare_flutter/flare_actor.dart:468:19)
E/flutter ( 7462): #7 FlareActorRenderObject.filename=.<anonymous closure> (package:flare_flutter/flare_actor.dart:245:11)
E/flutter ( 7462): #8 _rootRunUnary (dart:async/zone.dart:1132:38)
E/flutter ( 7462): #9 _CustomZone.runUnary (dart:async/zone.dart:1029:19)
E/flutter ( 7462): #10 _FutureListener.handleValue (dart:async/future_impl.dart:126:18)
E/flutter ( 7462): #11 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:639:45)
E/flutter ( 7462): #12 Future._propagateToListeners (dart:async/future_impl.dart:668:32)
E/flutter ( 7462): #13 Future._complete (dart:async/future_impl.dart:473:7)
E/flutter ( 7462): #14 _SyncCompleter.complete (dart:async/future_impl.dart:51:12)
E/flutter ( 7462): #15 _AsyncAwaitCompleter.complete.<anonymous closure> (dart:async/runtime/libasync_patch.dart:33:20)
E/flutter ( 7462): #16 _rootRun (dart:async/zone.dart:1120:38)
E/flutter ( 7462): #17 _CustomZone.run (dart:async/zone.dart:1021:19)
E/flutter ( 7462): #18 _CustomZone.runGuarded (dart:async/zone.dart:923:7)
E/flutter ( 7462): #19 _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:963:23)
E/flutter ( 7462): #20 _rootRun (dart:async/zone.dart:1124:13)
E/flutter ( 7462): #21 _CustomZone.run (dart:async/zone.dart:1021:19)
E/flutter ( 7462): #22 _CustomZone.runGuarded (dart:async/zone.dart:923:7)
E/flutter ( 7462): #23 _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:963:23)
E/flutter ( 7462): #24 _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
E/flutter ( 7462): #25 _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
E/flutter ( 7462):

我非常确定我没有输入错误的文件名和动画名称。

下面是我的 main.dart 文件:

import 'package:flutter/material.dart';
import "package:flare_flutter/flare_actor.dart";

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'The Boring Star',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(),
);
}
}

class MyHomePage extends StatefulWidget {
@override
_MyHomePageState createState() => new _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return new FlareActor("animations/status_success.flr",
alignment: Alignment.center,
fit: BoxFit.contain,
animation: "success_arrow");
}
}

-----编辑------我不知道为什么,但下面的动画效果很好 https://www.2dimensions.com/a/pollux/files/flare/smiley-switch

因此,它得出的结论是我的动画存在一些问题: https://www.2dimensions.com/a/innocent/files/flare/status_success

谁能帮我解决这个问题?

最佳答案

动画名称不是success_arrow而是success

FlareActor("animations/status_success.flr",
alignment: Alignment.center,
fit: BoxFit.contain,
animation: "success");

关于Flutter Flare 动画无法正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55040732/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com