栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

Boxshadow出现在其他小部件的后面

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Boxshadow出现在其他小部件的后面

发生这种情况的原因是,由于您在

Expanded
内部使用了小部件
Column
,因此它占用了屏幕上的所有可用空间,因此看起来好像是在重叠,
Container
但是实际上只是在阴影上。

代替

Column
小部件,使用
Stack
来显示
Container
上方的
ListView
。您可以使用
Positioned
小部件来放置堆栈的子小部件。

但是在这种情况下,请确保将

Container
代码放在代码之后,
ListView
以使其始终位于最前面。

例:

Stack(  children: <Widget>[    Padding(      padding: const EdgeInsets.all(10),      child: _buildCheckpointListView(context, model)    ),    Positioned(      top: 0.0, //To align Container at the top of screen      left: 0.0,      right: 0.0,      child: Container(        decoration: BoxDecoration(          color: Colors.red.shade200,          boxShadow: [ BoxShadow(   color: Colors.red.shade200,   offset: Offset(0, 10),   blurRadius: 10,   spreadRadius: 10          )]        ),        child: ListTile(          title: Text(''),        )     ),    ),  ])

如果要从顶部提供一定的边距,也可以将其包装

ListView
Positioned
小部件内。



转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/376108.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号