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