Flutter-Slidable

Slidable

滑动选项卡组件。

依赖引入

1
flutter_slidable: ^2.0.0

使用

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
Slidable(//可滑动的组件
//end代表从右边往左边滑动
endActionPane: ActionPane(//滑动选项面板
motion: const StretchMotion(),//滑动动画
children: [
//SlidableAction是单个滑动选项
SlidableAction(
onPressed: onDelete,//触发删除的函数
icon: Icons.delete,//图标
backgroundColor: Colors.redAccent,//背景色
borderRadius: BorderRadius.circular(12),//圆角
)
],
),
child: Container(
padding: const EdgeInsets.all(24),
// height: 60,
decoration: BoxDecoration(
color: Colors.orange,
borderRadius: BorderRadius.circular(12)
),
child: Row(
children: [
Checkbox(
value: finished,
onChanged: onChanged,
activeColor: Colors.black,
),
Text(
taskName,
style: TextStyle(decoration: finished?TextDecoration.lineThrough:TextDecoration.none),
overflow: TextOverflow.ellipsis,
)
],
),
),
)

Navigator.of(context).pop();//这样Navigator.pop(context);//或这样dart