feat: Added callbacks for default slidable options
This commit is contained in:
@@ -78,6 +78,8 @@ class ChannelListView extends StatefulWidget {
|
|||||||
this.emptyBuilder,
|
this.emptyBuilder,
|
||||||
this.loadingBuilder,
|
this.loadingBuilder,
|
||||||
this.listBuilder,
|
this.listBuilder,
|
||||||
|
this.onMoreDetailsPressed,
|
||||||
|
this.onDeletePressed,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
/// If true a default swipe to action behaviour will be added to this widget
|
/// If true a default swipe to action behaviour will be added to this widget
|
||||||
@@ -158,6 +160,12 @@ class ChannelListView extends StatefulWidget {
|
|||||||
/// The builder used when the channel list is empty.
|
/// The builder used when the channel list is empty.
|
||||||
final WidgetBuilder? emptyBuilder;
|
final WidgetBuilder? emptyBuilder;
|
||||||
|
|
||||||
|
/// Callback used when the more details slidable option is pressed
|
||||||
|
final VoidCallback? onMoreDetailsPressed;
|
||||||
|
|
||||||
|
/// Callback used when the delete slidable option is pressed
|
||||||
|
final VoidCallback? onDeletePressed;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_ChannelListViewState createState() => _ChannelListViewState();
|
_ChannelListViewState createState() => _ChannelListViewState();
|
||||||
}
|
}
|
||||||
@@ -469,7 +477,7 @@ class _ChannelListViewState extends State<ChannelListView> {
|
|||||||
IconSlideAction(
|
IconSlideAction(
|
||||||
color: backgroundColor,
|
color: backgroundColor,
|
||||||
icon: Icons.more_horiz,
|
icon: Icons.more_horiz,
|
||||||
onTap: () {
|
onTap: widget.onMoreDetailsPressed ?? () {
|
||||||
showModalBottomSheet(
|
showModalBottomSheet(
|
||||||
clipBehavior: Clip.hardEdge,
|
clipBehavior: Clip.hardEdge,
|
||||||
shape: const RoundedRectangleBorder(
|
shape: const RoundedRectangleBorder(
|
||||||
@@ -502,7 +510,7 @@ class _ChannelListViewState extends State<ChannelListView> {
|
|||||||
iconWidget: StreamSvgIcon.delete(
|
iconWidget: StreamSvgIcon.delete(
|
||||||
color: chatThemeData.colorTheme.accentRed,
|
color: chatThemeData.colorTheme.accentRed,
|
||||||
),
|
),
|
||||||
onTap: () async {
|
onTap: widget.onDeletePressed ?? () async {
|
||||||
final res = await showConfirmationDialog(
|
final res = await showConfirmationDialog(
|
||||||
context,
|
context,
|
||||||
title: 'Delete Conversation',
|
title: 'Delete Conversation',
|
||||||
|
|||||||
Reference in New Issue
Block a user