flutter - Slidable Widget 滑动时显示垂直线 - Flutter_slidable
问题描述
我正在使用Slidable Widget,它工作得很好,但是在滑动我的容器时有一个奇怪的行为。这是显示不应出现的垂直线的代码和 GIF。
编辑:我在好友列表中使用此幻灯片功能。因此我在一个循环中调用 createSlidable() 。在Slidable Widget 中,还有另一种创建子容器getFriendContainer() 的方法。
Widget getFriendContainer(Friend friend, int i) {
return Container(
padding: const EdgeInsets.only(left: 10.0, right: 10.0, top: 20, bottom: 10.0),
decoration: BoxDecoration(
color: Color.fromRGBO(13, 13, 56, 1.0),
borderRadius: i==0 ? BorderRadius.only(
topLeft: Radius.circular(25.0),
topRight: Radius.circular(25.0),
) : null,
),
child: Row(
children: <Widget>[
Expanded(
flex: 15,
child: Column(
children: <Widget>[
Container(
padding: const EdgeInsets.all(9.0),
height: 40.0,
decoration: BoxDecoration(
shape: BoxShape.circle,
border: Border.all(color: Color.fromRGBO(119, 119, 136, 1.0), width: 0.5),
),
child: Image.asset('assets/icon.png', width: 70.0, height: 70.0, color: Color.fromRGBO(119, 119, 136, 1.0),),
),
],
),
),
Expanded(
flex: 70,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(
padding: const EdgeInsets.only(left: 10.0),
child: Text(
"${friend.name}",
style: TextStyle(
fontWeight: FontWeight.w500,
fontSize: 14.0,
color: Colors.white,
),
)
),
],
),
),
Expanded(
flex: 15,
child: friend.muted ? friendMutedIcon(friend) : Container(),
),
],
),
);
}
Widget createSlidable(Friend friend, int i) {
return Slidable(
actionPane: SlidableDrawerActionPane(),
controller: _slidableController,
actionExtentRatio: 0.15,
child: ...,
secondaryActions: <Widget>[
SlideAction(
color: getFriendContainer(Friend friend, int i),
onTap: () {
},
child: Container(
height: 50.0,
width: 100.0,
decoration: BoxDecoration(
color: ...,
borderRadius: BorderRadius.only(
topLeft: const Radius.circular(25.0),
bottomLeft: const Radius.circular(25.0),
),
),
child: Icon(Icons.volume_off, color: ...,),
),
),
SlideAction(
color: ...,
onTap: () {
},
child: Container(
height: 50.0,
width: 100.0,
color: ...,
child: Icon(Icons.delete, color: ...,),
),
),
],
);
}
我将不胜感激任何帮助。
解决方案
我找到了解决方案。使用IconSlideAction
小部件代替SlideAction
问题已解决。
推荐阅读
- google-colaboratory - Google Colab 中的渲染出错了
- nested - 在adonis2中测试嵌套效果的正确方法
- angular - 角条纹添加卡片表单只允许一个输入按钮提交
- tinymce - 固定工具栏容器和表情插件的 TinyMCE 问题
- pine-script - 如何使用 pine 编辑器在 Tradingdview 中导入交易历史?
- python - tkinter:单击按钮时如何打印列表?
- python - 使用 Dask(和/或 xarray)并行和懒惰地进行短时傅里叶变换(频谱分析)
- assembly - Push 和 pop 干扰 ret 指令
- python - 如何将 for 循环的输出通过管道传输到另一个变量中
- r - 在R中,为什么有
在我读取数据框时的第一行