Improved merge dialog UI

This commit is contained in:
Abdelilah El Aissaoui 2021-10-28 04:28:50 +02:00
parent 67f1135b85
commit 7c2029d602

View file

@ -1,17 +1,22 @@
package app.ui.dialogs package app.ui.dialogs
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.background import androidx.compose.foundation.background
import androidx.compose.foundation.layout.* import androidx.compose.foundation.layout.*
import androidx.compose.foundation.mouseClickable
import androidx.compose.material.* import androidx.compose.material.*
import androidx.compose.runtime.* import androidx.compose.runtime.*
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.focus.FocusRequester import androidx.compose.ui.focus.FocusRequester
import androidx.compose.ui.focus.focusOrder import androidx.compose.ui.focus.focusOrder
import androidx.compose.ui.input.pointer.isPrimaryPressed
import androidx.compose.ui.text.TextStyle import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp import androidx.compose.ui.unit.sp
@OptIn(ExperimentalFoundationApi::class)
@Composable @Composable
fun MergeDialog( fun MergeDialog(
currentBranchName: String, currentBranchName: String,
@ -28,19 +33,37 @@ fun MergeDialog(
horizontalAlignment = Alignment.CenterHorizontally, horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center, verticalArrangement = Arrangement.Center,
) { ) {
Row { Row(
Text( verticalAlignment = Alignment.CenterVertically,
text = currentBranchName, ) {
)
Text(" -----------> ")
Text( Text(
text = mergeBranchName, text = mergeBranchName,
fontWeight = FontWeight.Medium
)
Text(
text = "will be merged into",
modifier = Modifier.padding(horizontal = 8.dp)
)
Text(
text = currentBranchName,
fontWeight = FontWeight.Medium
) )
} }
Row { Row(
verticalAlignment = Alignment.CenterVertically,
modifier = Modifier
.mouseClickable {
if(this.buttons.isPrimaryPressed) {
fastForwardCheck = !fastForwardCheck
}
}
) {
Checkbox( Checkbox(
checked = fastForwardCheck, checked = fastForwardCheck,
onCheckedChange = { checked -> onCheckedChange = { checked ->
@ -50,7 +73,8 @@ fun MergeDialog(
Text( Text(
"Fast forward", "Fast forward",
modifier = Modifier.padding(start = 8.dp) modifier = Modifier
.padding(start = 8.dp)
) )
} }