feat(ui): Calculate slidable extentRatio in case of custom actions
Signed-off-by: xsahil03x <[email protected]>
This commit is contained in:
@@ -513,13 +513,19 @@ class _ChannelListViewState extends State<ChannelListView> {
|
|||||||
final canDeleteChannel =
|
final canDeleteChannel =
|
||||||
channel.ownCapabilities.contains(PermissionType.deleteChannel);
|
channel.ownCapabilities.contains(PermissionType.deleteChannel);
|
||||||
|
|
||||||
|
final actionPaneChildren =
|
||||||
|
widget.swipeActions?.length ?? (canDeleteChannel ? 2 : 1);
|
||||||
|
final actionPaneExtentRatio = actionPaneChildren > 5
|
||||||
|
? 1 / actionPaneChildren
|
||||||
|
: actionPaneChildren * 0.2;
|
||||||
|
|
||||||
return StreamChannel(
|
return StreamChannel(
|
||||||
key: ValueKey<String>('CHANNEL-${channel.cid}'),
|
key: ValueKey<String>('CHANNEL-${channel.cid}'),
|
||||||
channel: channel,
|
channel: channel,
|
||||||
child: Slidable(
|
child: Slidable(
|
||||||
enabled: widget.swipeToAction,
|
enabled: widget.swipeToAction,
|
||||||
endActionPane: ActionPane(
|
endActionPane: ActionPane(
|
||||||
extentRatio: canDeleteChannel ? 0.4 : 0.2,
|
extentRatio: actionPaneExtentRatio,
|
||||||
motion: const BehindMotion(),
|
motion: const BehindMotion(),
|
||||||
children: widget.swipeActions
|
children: widget.swipeActions
|
||||||
?.map((e) => CustomSlidableAction(
|
?.map((e) => CustomSlidableAction(
|
||||||
|
|||||||
Reference in New Issue
Block a user