gpt4 book ai didi

animation - Android 上的 Flutter 动画 : D/skia (22985): Could not invert viewmatrix

转载 作者:IT王子 更新时间:2023-10-29 06:55:20 26 4
gpt4 key购买 nike

重现步骤

在不深入研究代码的情况下,每次时间变化时我都会触发一个动画,其中:

@override
Widget build(BuildContext context) {

if (this._currentTime != widget.amountOfTime) {
this._changeTimeAnimation();
}

return new AnimatedBuilder(
animation: this._animation,
builder: (BuildContext context, Widget child) => this._flipAnimation(child),
child: new Text(
this._currentTime,
textAlign: TextAlign.left,
style: new TextStyle(fontSize: 100.0),
),
);
}

this._flipAnimation() 如下:

Transform _flipAnimation(Widget child) {
/// Function used to generate a flip animation for the time

final Matrix4 transform = new Matrix4.identity()
..scale(1.0, this._animation.value, 1.0);

return Transform(
transform: transform,
alignment: FractionalOffset.center,
child: child,
);
}

每次触发动画时,我都会收到消息 D/skia (22985): Could not invert viewmatrix。这是为什么?

我会注意到,动画在设备上似乎运行良好,但打印输出很奇怪。

日志

flutter run 之后:

Performing full restart...
Restarted app in 2,182ms.
D/skia (22985): Could not invert viewmatrix
D/skia (22985): Could not invert viewmatrix
D/skia (22985): Could not invert viewmatrix
D/skia (22985): Could not invert viewmatrix
D/skia (22985): Could not invert viewmatrix

flutter 医生

运行 flutter doctor -v 后:

[✓] Flutter (Channel beta, v0.2.8, on Mac OS X 10.13.4 17E199, locale en-US)
• Flutter version 0.2.8 at /Users/jvanderen11/flutter
• Framework revision b397406561 (13 days ago), 2018-04-02 13:53:20 -0700
• Engine revision c903c217a1
• Dart version 2.0.0-dev.43.0.flutter-52afcba357

[✓] Android toolchain - develop for Android devices (Android SDK
27.0.3)
• Android SDK at /Users/jvanderen11/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-27, build-tools 27.0.3
• Java binary at: /Applications/Developer Tools/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)
• All Android licenses accepted.

[✓] iOS toolchain - develop for iOS devices (Xcode 9.3)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 9.3, Build version 9E145
• ios-deploy 1.9.2
• CocoaPods version 1.5.0

[✓] Android Studio (version 3.1)
• Android Studio at /Applications/Developer Tools/Android Studio.app/Contents
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)

[✓] IntelliJ IDEA Ultimate Edition (version 2018.1.1)
• IntelliJ at /Users/jvanderen11/Applications/JetBrains Toolbox/IntelliJ IDEA Ultimate.app
• Flutter plugin version 23.1.3
• Dart plugin version 181.4203.498

[✓] Connected devices (1 available)
• Android SDK built for x86 • emulator-5554 • android-x86 • Android 7.1.1 (API 25) (emulator)

• No issues found!

最佳答案

错误的原因是当缩放比例为 (1.0, 0.0, 1.0) 时,它会导致矩阵 Skia 不喜欢(可能无效 - 参见 where skia generates the error ,我认为是 the line where it causes the error )。

一个简单的解决方法是确保您从未真正通过 scale(1.0, 0.0, 1.0),要么通过修改您的代码,要么每次都向数字中添加非常小的数量,即 ..scale(1.0, this._animation.value + smallval, 1.0)

显然 smallval=1e-100 太小了,因为它在为 skia 转换为 c++ 时丢失了,但是 smallval=0.00000000000000000000000000000000000000000000000001 确实有效。

关于animation - Android 上的 Flutter 动画 : D/skia (22985): Could not invert viewmatrix,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49867856/

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