我创建了一个用于执行这种布局的程序包:
flutter_slidable(感谢RémiRousselet的基本想法)
使用此软件包,可以更轻松地为列表项创建上下文操作。例如,如果要创建描述的动画类型:
抽屉(iOS)动画
您将使用以下代码:
new Slidable( delegate: new SlidableDrawerDelegate(), actionExtentRatio: 0.25, child: new Container( color: Colors.white, child: new ListTile( leading: new CircleAvatar( backgroundColor: Colors.indigoAccent, child: new Text('$3'), foregroundColor: Colors.white, ), title: new Text('Tile n°$3'), subtitle: new Text('SlidableDrawerDelegate'), ), ), actions: <Widget>[ new IconSlideAction( caption: 'Archive', color: Colors.blue, icon: Icons.archive, onTap: () => _showSnackBar('Archive'), ), new IconSlideAction( caption: 'Share', color: Colors.indigo, icon: Icons.share, onTap: () => _showSnackBar('Share'), ), ], secondaryActions: <Widget>[ new IconSlideAction( caption: 'More', color: Colors.black45, icon: Icons.more_horiz, onTap: () => _showSnackBar('More'), ), new IconSlideAction( caption: 'Delete', color: Colors.red, icon: Icons.delete, onTap: () => _showSnackBar('Delete'), ), ],);


