class _MyHomeState extends State<MyHome> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Flutter Demo'),
),
body: ListView(
children: <Widget>[
Dismissible(
background: Container(
color: Colors.green,
child: Align(
alignment: AlignmentDirectional.centerStart,
child: Padding(
padding: EdgeInsets.only(left: 8),
child: Icon(Icons.favorite),
),
),
),
secondaryBackground: Container(
color: Colors.red,
child: Align(
alignment: AlignmentDirectional.centerEnd,
child: Padding(
padding: EdgeInsets.only(right: 8),
child: Icon(Icons.delete),
),
),
),
child: ListTile(
title: Text('aaaaaa'),
),
key: ValueKey('aaaaaa'),
onDismissed: (DismissDirection direction) {
print(direction);
},
),
],
));
}
}