【问题标题】:How to clip the overflowed image bottom of screen如何剪辑屏幕溢出的图像底部
【发布时间】:2020-11-06 13:31:53
【问题描述】:

我的屏幕底部没有太多空间,我希望图像尽可能多地占据空间,并剪切或“忽略”图像的溢出部分。

到目前为止我尝试过: 与 Overflow.clip 和 CLip.antiAlias 堆叠, 容器中的 BoxDecoration (在这个解决方案中,我什至看不到图像), 剪辑矩形

而且总是有错误,底部溢出107像素。

【问题讨论】:

标签: flutter flutter-layout


【解决方案1】:

尝试使用 SingleChildScrollView 包装您的小部件

Stack(
   overflow: Overflow.clip,
   children:
   [ 
       SingleChildScrollView(
         child: (
           ....
          ),
       ),
   ]
)

【讨论】:

  • 我尝试了以下,但仍然溢出Stack( overflow: Overflow.clip, children: [ SingleChildScrollView( child: Container( decoration: BoxDecoration(image: DecorationImage( fit: BoxFit.fill, image: AssetImage(getIndexedBannerUrl(_bannerToIndex)) )), ), ) ], )
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2021-09-03
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多