class _ContactItemState extends State<_ContactItem> {
final ContactDao _dao = ContactDao();
bool isNotTaped = true;
@override
Widget build(BuildContext context) {
return Card(
color: Colors.green[100],
child: SingleChildScrollView(
child: ListTile(
title: Text(
widget.contact.name,
style: const TextStyle(
fontSize: 24.0,
),
),
subtitle: Text(
widget.contact.accountNumber.toString(),
style: const TextStyle(
fontSize: 16.0,
),
),
trailing: IconButton(
icon: const Icon(Icons.delete),
iconSize: 30,
color: (isNotTaped ? Colors.green[400] : Colors.red[400]),
onPressed: () {
setState(() {
_dao.delete(id);
isNotTaped = !isNotTaped;
});
},
),
),
),
);
}
}