图像的剪切部分在颤动中超出了容器的边界

问题描述 投票:0回答:1

我有一个图像容器。当剪辑图像时,某些图像部分会显示在容器之外。

我在容器外部图像部分的右侧添加一张图像。

 child: Container(
            height: height,
            width: width,
            decoration: BoxDecoration(
              color: Colors.transparent,
              border: Border.all(
                width: 2,
                color: _isSelected && _showAlternateContainer ? Colors.black : Colors.transparent,
              ),
            ),
            child: ClipRect(
               clipper: MyCustomClipper( clipLeft, clipTop, clipWidth, clipHeight),
                child: Image.asset(
                        image,
                        width: width,
                        height: height,
                        fit: BoxFit.cover,
                      ),
              ),
            ),

flutter dart flutter-container
1个回答
0
投票

不知道您的自定义剪裁器,但我猜容器已在此处结束,如图中标记的那样。

您可以提供填充以适应它或减小图像的大小。

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