fliped dismiss direction
This commit is contained in:
parent
b458393948
commit
d914b8bcae
|
|
@ -95,39 +95,38 @@ class _CheckList extends State<CheckList> {
|
|||
return Dismissible(
|
||||
key: Key(list[index].id.toString()),
|
||||
confirmDismiss: (direction) async {
|
||||
if (direction == DismissDirection.startToEnd) {
|
||||
var item = list[index];
|
||||
if (direction == DismissDirection.endToStart) {
|
||||
setState(() {
|
||||
_removeItem(list[index]);
|
||||
_removeItem(item);
|
||||
list.removeAt(index);
|
||||
});
|
||||
return true;
|
||||
}
|
||||
_updateItem(item);
|
||||
setState(() {
|
||||
list[index].value = !list[index].value;
|
||||
item.value = !item.value;
|
||||
});
|
||||
return false;
|
||||
},
|
||||
secondaryBackground: Container(
|
||||
child: Container(
|
||||
background: Container(
|
||||
color: Colors.blue,
|
||||
child: Row(children: const [
|
||||
Spacer(),
|
||||
Padding(
|
||||
padding: EdgeInsets.all(10),
|
||||
child: Icon(Icons.check)),
|
||||
])),
|
||||
child: Icon(Icons.check),
|
||||
),
|
||||
background: Container(
|
||||
child: Container(
|
||||
Spacer(),
|
||||
]),
|
||||
),
|
||||
secondaryBackground: Container(
|
||||
color: Colors.red,
|
||||
child: Row(children: const [
|
||||
Spacer(),
|
||||
Padding(
|
||||
padding: EdgeInsets.all(10),
|
||||
child: Icon(
|
||||
Icons.delete_forever,
|
||||
)),
|
||||
Spacer(),
|
||||
])),
|
||||
child: Icon(Icons.delete_forever)),
|
||||
]),
|
||||
),
|
||||
child: CheckboxListTile(
|
||||
title: TextFormField(
|
||||
|
|
|
|||
Loading…
Reference in New Issue