Merge pull request #1035 from GetStream/slidable-extent-ratio

feat(ui): calculate slidable extentRatio in case of custom actions
This commit is contained in:
Salvatore Giordano
2022-03-22 10:42:43 +01:00
committed by GitHub
@@ -513,13 +513,19 @@ class _ChannelListViewState extends State<ChannelListView> {
final canDeleteChannel =
channel.ownCapabilities.contains(PermissionType.deleteChannel);
final actionPaneChildren =
widget.swipeActions?.length ?? (canDeleteChannel ? 2 : 1);
final actionPaneExtentRatio = actionPaneChildren > 5
? 1 / actionPaneChildren
: actionPaneChildren * 0.2;
return StreamChannel(
key: ValueKey<String>('CHANNEL-${channel.cid}'),
channel: channel,
child: Slidable(
enabled: widget.swipeToAction,
endActionPane: ActionPane(
extentRatio: canDeleteChannel ? 0.4 : 0.2,
extentRatio: actionPaneExtentRatio,
motion: const BehindMotion(),
children: widget.swipeActions
?.map((e) => CustomSlidableAction(