Flutter Projects by Simone Alessandria

Flutter Projects by Simone Alessandria

Author:Simone Alessandria [Simone Alessandria]
Language: eng
Format: epub
Tags: COM051460 - COMPUTERS / Programming / Mobile Devices, COM051370 - COMPUTERS / Programming / Macintosh, COM012040 - COMPUTERS / Programming / Games
Publisher: Packt Publishing
Published: 2020-04-07T09:40:07+00:00


Solution:

In the itemBuilder of the ListView.builder, in the build() method of the _ItemsScreenState class in the items_screen.dart file, add a Dismissible widget, as follows:

itemBuilder: (BuildContext context, int index) {

return Dismissible(

key: Key(items[index].name),

onDismissed: (direction) {

String strName = items[index].name;

helper.deleteItem(items[index]);

setState(() {

items.removeAt(index);

});

Scaffold.of(context)

.showSnackBar(SnackBar(content: Text("$strName

deleted")));

},

child: ListTile(

The app is now complete. There's only one more step to perform: making sure that it works as expected.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.