flutter make a slide to delete container code example

Example: flutter swipeable to reveal more actions

Padding(
        padding: const EdgeInsets.all(8.0),
        child: ListView.builder(
            itemCount: the_length_of_your_items,
            itemBuilder: (BuildContext context,int index) {
              return Slidable(
                actionPane: SlidableDrawerActionPane(),
                actionExtentRatio: 0.25,
                child: Container(
                  color: Colors.white,
                  child: ListTile(
                    leading: Text(('the_leading')),
                    title: Text(('the_title')),
                    trailing: Text(('the_trailing')),
                    subtitle: Text(('the_subtitle')),
                  ),
                ),
                actions: <Widget>[
                  IconSlideAction(
                     caption: 'Archive',
                    color: Colors.blue,
                    icon: Icons.archive,
                    onTap: () {print('archive');},
                  ),
                  IconSlideAction(
                    caption: 'Share',
                    color: Colors.indigo,
                    icon: Icons.share,
                    onTap: () {print('share');},
                  ),
                ],
                secondaryActions: <Widget>[
                  IconSlideAction(
                    caption: 'More',
                    color: Colors.black45,
                    icon: Icons.more_horiz,
                    onTap: ()  {print('more');},
                  ),
                  IconSlideAction(
                    caption: 'Delete',
                    color: Colors.red,
                    icon: Icons.delete,
                    onTap: () {print('delete');},
                  ),
                ],
              );
            }),
      ),

Tags:

Misc Example