【发布时间】:2020-08-17 23:10:02
【问题描述】:
将elevation 添加到Material 小部件后,我只想保留底部阴影。不想要左右两边的阴影。如何做到这一点?
这是我的代码:
// searchbar
child: Material(
color: Colors.transparent,
elevation: 5.0,
child: Container(
margin: EdgeInsets.symmetric(horizontal: 10.0),
color: AppColors.searchBoxColor,
child: Row(
children: <Widget>[
IconButton(
icon: Icon(Icons.arrow_back),
onPressed: () {},
),
// searchfield
Expanded(
child: Container(
alignment: Alignment.center,
height: AppBar().preferredSize.height,
child: TextField(
decoration: InputDecoration(
border: InputBorder.none,
hintText: "Hint Text",
),
),
),
),
],
),
),
),
【问题讨论】:
-
好的,你能提供一些可复制的代码和一些图片来说明你的意思吗?
-
@LonelyWolf 我已经添加了代码。我只想删除添加高程属性后得到的水平阴影。
-
嗨@Newaj。我已经更新了我的答案,用你的代码应用了阴影。希望能帮助到你! :)
标签: flutter