如何避免动画时底部溢出-颤振

问题描述 投票:-1回答:2

我有一个AnimatedContainer,当我轻按容器时,该容器具有打开/关闭动画,但底部有38像素的错误溢出。

在此视频中显示:

https://photos.google.com/share/AF1QipPsio8RS5BD0D1OzMbMA6sNCBamLF8nYEyml_-pPqKVe-tzza-PyvB3MQehdHKeNQ/photo/AF1QipPYOoZ6pOXARbd3SdpxY8OWegQxvFHtv2QNh7NQ?key=V0lhQnpPOWtCRm1RZ21yUnp6TkFZdmtKdWFuVk13

这是我的代码:

Column(
  children: <Widget> [
    GestureDetector(
      child: Container(
      duration: duration,
      child: all the content
    ),
    onTap: () {
      is_opened = !is_opened;  
    }
)
AniamtedOpacity(
  duration: duration,
  opacity: is_opened ? 1 : 0
      child: Container(
          child: Row(
            children: <Widget>[
              //Icons and texts
            ],
          ),
        ),
      ),
    ],
  )

感谢您的帮助

flutter flutter-layout flutter-animation
2个回答
0
投票

没有代码,很难解决这个问题,但是尝试执行以下操作

  1. 如果使用SizedBox,则将其高度增加38像素。

0
投票

在由动画容器和容器组成的窗口小部件上使用扩展。

© www.soinside.com 2019 - 2024. All rights reserved.