Add double click to checkout branch
This commit is contained in:
parent
8810150429
commit
c6163f1ef4
@ -44,6 +44,7 @@ fun Branches(
|
||||
currentBranch = currentBranch,
|
||||
isCurrentBranch = currentBranch?.name == branch.name,
|
||||
onBranchClicked = { branchesViewModel.selectBranch(branch) },
|
||||
onBranchDoubleClicked = { branchesViewModel.checkoutRef(branch) },
|
||||
onCheckoutBranch = { branchesViewModel.checkoutRef(branch) },
|
||||
onMergeBranch = { setMergeBranch(branch) },
|
||||
onDeleteBranch = { branchesViewModel.deleteBranch(branch) },
|
||||
@ -80,6 +81,7 @@ private fun BranchLineEntry(
|
||||
currentBranch: Ref?,
|
||||
isCurrentBranch: Boolean,
|
||||
onBranchClicked: () -> Unit,
|
||||
onBranchDoubleClicked: () -> Unit,
|
||||
onCheckoutBranch: () -> Unit,
|
||||
onMergeBranch: () -> Unit,
|
||||
onRebaseBranch: () -> Unit,
|
||||
@ -107,7 +109,8 @@ private fun BranchLineEntry(
|
||||
text = branch.simpleName,
|
||||
iconResourcePath = "branch.svg",
|
||||
bold = isCurrentBranch,
|
||||
onClick = onBranchClicked
|
||||
onClick = onBranchClicked,
|
||||
onDoubleClick = onBranchDoubleClicked
|
||||
) {
|
||||
if (isCurrentBranch) {
|
||||
Icon(
|
||||
|
@ -2,7 +2,9 @@
|
||||
|
||||
package app.ui.components
|
||||
|
||||
import androidx.compose.foundation.ExperimentalFoundationApi
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.combinedClickable
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.material.Icon
|
||||
import androidx.compose.material.MaterialTheme
|
||||
@ -19,6 +21,7 @@ import androidx.compose.ui.unit.sp
|
||||
import app.ENTRY_HEIGHT
|
||||
import app.theme.primaryTextColor
|
||||
|
||||
@OptIn(ExperimentalFoundationApi::class)
|
||||
@Composable
|
||||
fun SideMenuSubentry(
|
||||
text: String,
|
||||
@ -26,6 +29,7 @@ fun SideMenuSubentry(
|
||||
bold: Boolean = false,
|
||||
extraPadding: Dp = 0.dp,
|
||||
onClick: (() -> Unit)? = null,
|
||||
onDoubleClick: (() -> Unit)? = null,
|
||||
additionalInfo: @Composable () -> Unit = {}
|
||||
) {
|
||||
Row(
|
||||
@ -33,8 +37,8 @@ fun SideMenuSubentry(
|
||||
.height(ENTRY_HEIGHT.dp)
|
||||
.fillMaxWidth()
|
||||
.run {
|
||||
if (onClick != null)
|
||||
clickable(onClick = onClick)
|
||||
if (onClick != null && onDoubleClick != null)
|
||||
combinedClickable(onClick = onClick, onDoubleClick = onDoubleClick)
|
||||
else
|
||||
this
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user