Fixed menu padding missalignments

This commit is contained in:
Abdelilah El Aissaoui 2022-06-06 12:52:56 +02:00
parent a34c6f194d
commit 6901bf9f1c

View File

@ -53,6 +53,7 @@ fun Menu(
Spacer(modifier = Modifier.weight(1f)) Spacer(modifier = Modifier.weight(1f))
ExtendedMenuButton( ExtendedMenuButton(
modifier = Modifier.padding(end = 8.dp),
title = "Pull", title = "Pull",
icon = painterResource("download.svg"), icon = painterResource("download.svg"),
onClick = { menuViewModel.pull() }, onClick = { menuViewModel.pull() },
@ -80,7 +81,7 @@ fun Menu(
) )
) )
Spacer(modifier = Modifier.width(16.dp)) Spacer(modifier = Modifier.width(24.dp))
MenuButton( MenuButton(
title = "Branch", title = "Branch",
@ -90,9 +91,10 @@ fun Menu(
}, },
) )
Spacer(modifier = Modifier.width(16.dp)) Spacer(modifier = Modifier.width(24.dp))
MenuButton( MenuButton(
modifier = Modifier.padding(end = 8.dp),
title = "Stash", title = "Stash",
icon = painterResource("stash.svg"), icon = painterResource("stash.svg"),
onClick = { menuViewModel.stash() }, onClick = { menuViewModel.stash() },
@ -153,9 +155,8 @@ fun MenuButton(
Box( Box(
modifier = modifier modifier = modifier
.padding(horizontal = 2.dp)
.handMouseClickable { if (enabled) onClick() } .handMouseClickable { if (enabled) onClick() }
.border(ButtonDefaults.outlinedBorder, RoundedCornerShape(3.dp)) .border(ButtonDefaults.outlinedBorder, RoundedCornerShape(4.dp))
.padding(vertical = 8.dp, horizontal = 16.dp), .padding(vertical = 8.dp, horizontal = 16.dp),
) { ) {
Row( Row(
@ -196,39 +197,35 @@ fun ExtendedMenuButton(
var showDropDownMenu by remember { mutableStateOf(false) } var showDropDownMenu by remember { mutableStateOf(false) }
Row(modifier = Modifier.height(IntrinsicSize.Min)) { Row(modifier = modifier.height(IntrinsicSize.Min)) {
Box( Row(
modifier = modifier modifier = Modifier
.handMouseClickable { if (enabled) onClick() } .handMouseClickable { if (enabled) onClick() }
.border(ButtonDefaults.outlinedBorder, RoundedCornerShape(topStart = 3.dp, bottomStart = 3.dp)) .border(ButtonDefaults.outlinedBorder, RoundedCornerShape(topStart = 4.dp, bottomStart = 4.dp))
.padding(vertical = 8.dp, horizontal = 16.dp), .padding(vertical = 8.dp, horizontal = 16.dp),
horizontalArrangement = Arrangement.Center,
verticalAlignment = Alignment.CenterVertically,
) { ) {
Row( Image(
horizontalArrangement = Arrangement.Center, painter = icon,
verticalAlignment = Alignment.CenterVertically, contentDescription = title,
) { modifier = Modifier
Image( .padding(horizontal = 4.dp)
painter = icon, .size(24.dp),
contentDescription = title, colorFilter = ColorFilter.tint(iconColor),
modifier = Modifier )
.padding(horizontal = 4.dp) Text(
.size(24.dp), text = title,
colorFilter = ColorFilter.tint(iconColor), fontSize = 12.sp,
) color = MaterialTheme.colors.primaryTextColor
Text( )
text = title,
fontSize = 12.sp,
color = MaterialTheme.colors.primaryTextColor
)
}
} }
Box( Box(
modifier = modifier modifier = Modifier
.padding(end = 8.dp)
.width(20.dp) .width(20.dp)
.fillMaxHeight() .fillMaxHeight()
.border(ButtonDefaults.outlinedBorder, RoundedCornerShape(topEnd = 3.dp, bottomEnd = 3.dp)) .border(ButtonDefaults.outlinedBorder, RoundedCornerShape(topEnd = 4.dp, bottomEnd = 4.dp))
.handMouseClickable { .handMouseClickable {
showDropDownMenu = true showDropDownMenu = true
}, },