如何在抖动中绕过ArtboardRive

问题描述

如何绕过画板?
我想在屏幕底部稍微移动一下按钮
我使用bottomNavigationBar,但是我的按钮从底部屏幕上移到了高点

Example image Click Here

bottomNavigationBar: Row(
    children: [
      Expanded(
        child: GestureDetector(
          child: SizedBox(
            width: 190,height: 190,child: FlareActor(
              'assets/Plus_Animation_Button.flr',animation: 'Stay',controller: _Animation_Plus,sizefromArtboard: false,fit: BoxFit.cover,),onTap: _CheckPlus(),Expanded(
        flex: 1,child: Padding(padding: EdgeInsets.all(2)),Expanded(
        child: GestureDetector(
          child: SizedBox(
            width: 190,child: FlareActor(
              'assets/Minus_Animation_Button.flr',controller: _Animation_Minus,onTap: _CheckMinus(),],

我英语不好 非常感谢!

解决方法

有几种方法可以做到这一点。我会尝试其中一些工具/选项的组合:

  1. 通过将适合的布局和对齐方式更改为适合您的布局来帮助对齐(我会尝试适合:BoxFit.contain和alignment:首先是Alignment.bottomCenter)。

  2. 通过提供sizeFromArtboard:真实的FlareActor,更改画板的尺寸,并告诉FlareActor调整画板的尺寸(在Flutter中使用内在尺寸)。

  3. 使用自定义形状使用替代边界(而不是画板的边界)。如果您想要的边界框与画板本身不同,这将很有帮助。在Rive中,在感兴趣的项目上方创建一个不可见的矩形(例如另一个画板/边界)。为其命名,以便在Flutter中进行引用(例如“ boundsRectangle”)。然后向FlareActor小部件提供boundsNode:“ boundsRectangle”。