Improved menu bar

This commit is contained in:
Abdelilah El Aissaoui 2022-10-27 20:05:45 +02:00
parent bf6afc82c6
commit b4c304371c

View File

@ -92,12 +92,12 @@ fun Menu(
onCreateBranch() onCreateBranch()
} }
MenuButton( // MenuButton(
title = "Merge", // title = "Merge",
icon = painterResource("merge.svg"), // icon = painterResource("merge.svg"),
) { // ) {
onCreateBranch() // onCreateBranch()
} // }
Spacer(modifier = Modifier.width(32.dp)) Spacer(modifier = Modifier.width(32.dp))
@ -164,14 +164,14 @@ fun MenuButton(
contentDescription = title, contentDescription = title,
modifier = Modifier modifier = Modifier
.size(24.dp), .size(24.dp),
tint = MaterialTheme.colors.onPrimary, tint = MaterialTheme.colors.onBackground,
) )
Text( Text(
text = title, text = title,
style = MaterialTheme.typography.caption, style = MaterialTheme.typography.caption,
maxLines = 1, maxLines = 1,
textAlign = TextAlign.Center, textAlign = TextAlign.Center,
color = MaterialTheme.colors.onPrimary, color = MaterialTheme.colors.onBackground,
) )
} }
} }
@ -193,6 +193,9 @@ fun ExtendedMenuButton(
.ignoreKeyEvents() .ignoreKeyEvents()
.clip(RoundedCornerShape(4.dp)) .clip(RoundedCornerShape(4.dp))
.background(MaterialTheme.colors.surface) .background(MaterialTheme.colors.surface)
.handMouseClickable {
showDropDownMenu = true
}
) { ) {
Column( Column(
modifier = Modifier modifier = Modifier
@ -207,12 +210,12 @@ fun ExtendedMenuButton(
contentDescription = title, contentDescription = title,
modifier = Modifier modifier = Modifier
.size(24.dp), .size(24.dp),
tint = MaterialTheme.colors.onPrimary, tint = MaterialTheme.colors.onBackground,
) )
Text( Text(
text = title, text = title,
style = MaterialTheme.typography.caption, style = MaterialTheme.typography.caption,
color = MaterialTheme.colors.onPrimary, color = MaterialTheme.colors.onBackground,
maxLines = 1, maxLines = 1,
) )
} }
@ -220,17 +223,14 @@ fun ExtendedMenuButton(
Box( Box(
modifier = Modifier modifier = Modifier
.fillMaxHeight() .fillMaxHeight()
.ignoreKeyEvents() .ignoreKeyEvents(),
.handMouseClickable {
showDropDownMenu = true
},
contentAlignment = Alignment.Center, contentAlignment = Alignment.Center,
) { ) {
Icon( Icon(
painterResource("expand_more.svg"), painterResource("expand_more.svg"),
contentDescription = null, contentDescription = null,
tint = MaterialTheme.colors.onPrimary, tint = MaterialTheme.colors.onBackground,
modifier = Modifier.size(16.dp) modifier = Modifier.size(16.dp)
) )