feat(ui): Calculate slidable extentRatio in case of custom actions

Signed-off-by: xsahil03x <[email protected]>
This commit is contained in:
Sahil Kumar
2022-03-22 15:09:00 +05:30
committed by xsahil03x
parent cc84a8707e
commit 5f93867657
@@ -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(