首页 > 解决方案 > 隐藏溢出颤动,没有溢出消息

问题描述

我有一个想要部分可见的动画。

在此处输入图像描述

基本上屏幕的结尾应该将动画切成两半。所以动画是溢出的,但这是有意的。那么如何删除溢出的消息?

return ClipRect(
  child: Container(
    width: MediaQuery.of(context).size.width - 32,
    child: Padding(
      padding: const EdgeInsets.fromLTRB(spacingM, spacingM, 0, spacingM),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        children: [
          TextInfo(
              location: location, dateFormatter: dateFormatter, date: date),
          Transform.translate(
            offset: Offset(30, 0),
            child: WeatherAnimation(),
          ),
        ],
      ),
    ),
  ),
);

标签: flutterflutter-layout

解决方案


尝试使用FittedBox包装溢出的内容。这将剪掉溢出的内容。

在这种情况下,我相信您应该包装Padding小部件,或者可能是Row小部件,FittedBox以允许FittedBox其形成其父级并剪辑子级以适应。


推荐阅读