1
0
mirror of https://github.com/flutter/samples.git synced 2025-11-08 13:58:47 +00:00

Added trailing button to delete cart item in provider_shopper App (#571)

This commit is contained in:
Alabhya
2020-10-30 23:28:48 +05:30
committed by GitHub
parent 2165099fc9
commit 0188371865
3 changed files with 16 additions and 3 deletions

View File

@@ -46,6 +46,12 @@ class _CartList extends StatelessWidget {
itemCount: cart.items.length,
itemBuilder: (context, index) => ListTile(
leading: Icon(Icons.done),
trailing: IconButton(
icon: Icon(Icons.remove_circle_outline),
onPressed: () {
cart.remove(cart.items[index]);
},
),
title: Text(
cart.items[index].name,
style: itemNameStyle,