可能是因为动画的尺寸太大,超出了父容器的限制。你可以尝试把动画容器的尺寸调整为合适的大小,或者使用 FittedBox 等组件进行自适应缩放。例如:

Widget side_cat() {
  return FittedBox(
    fit: BoxFit.contain,
    child: RiveAnimation.asset(
      'assets/cat.riv',
      animations: ['Sulamine'],
      controllers: [_controller3],
    ),
  );
}

这样可以让动画自适应父容器的大小,并保持宽高比例不变。你可以根据实际情况调整 FittedBox 的 fit 属性,以达到最佳的显示效果。

Flutter 动画报错:RenderSemanticsGestureHandler does not meet its constraints

原文地址: https://www.cveoy.top/t/topic/ocs2 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录