feat: Added list of actions to channel_list_view.dart

This commit is contained in:
Deven Joshi
2021-05-31 11:30:51 +05:30
parent 765ca60343
commit ceaf30e545
@@ -80,6 +80,7 @@ class ChannelListView extends StatefulWidget {
this.listBuilder,
this.onMoreDetailsPressed,
this.onDeletePressed,
this.swipeActions,
}) : super(key: key);
/// If true a default swipe to action behaviour will be added to this widget
@@ -166,6 +167,9 @@ class ChannelListView extends StatefulWidget {
/// Callback used when the delete slidable option is pressed
final VoidCallback? onDeletePressed;
/// Actions shown when list tile is swiped
final List<IconSlideAction>? swipeActions;
@override
_ChannelListViewState createState() => _ChannelListViewState();
}
@@ -473,11 +477,13 @@ class _ChannelListViewState extends State<ChannelListView> {
enabled: widget.swipeToAction,
actionPane: const SlidableBehindActionPane(),
actionExtentRatio: 0.12,
secondaryActions: <Widget>[
secondaryActions: widget.swipeActions ??
<Widget>[
IconSlideAction(
color: backgroundColor,
icon: Icons.more_horiz,
onTap: widget.onMoreDetailsPressed ?? () {
onTap: widget.onMoreDetailsPressed ??
() {
showModalBottomSheet(
clipBehavior: Clip.hardEdge,
shape: const RoundedRectangleBorder(
@@ -510,7 +516,8 @@ class _ChannelListViewState extends State<ChannelListView> {
iconWidget: StreamSvgIcon.delete(
color: chatThemeData.colorTheme.accentRed,
),
onTap: widget.onDeletePressed ?? () async {
onTap: widget.onDeletePressed ??
() async {
final res = await showConfirmationDialog(
context,
title: 'Delete Conversation',