Changed top menu design
This commit is contained in:
parent
3d5bc35c07
commit
87a701b4a5
@ -4,9 +4,8 @@ package com.jetpackduba.gitnuro.ui
|
|||||||
|
|
||||||
import androidx.compose.foundation.ExperimentalFoundationApi
|
import androidx.compose.foundation.ExperimentalFoundationApi
|
||||||
import androidx.compose.foundation.Image
|
import androidx.compose.foundation.Image
|
||||||
import androidx.compose.foundation.border
|
import androidx.compose.foundation.background
|
||||||
import androidx.compose.foundation.layout.*
|
import androidx.compose.foundation.layout.*
|
||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
||||||
import androidx.compose.material.*
|
import androidx.compose.material.*
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.filled.ArrowDropDown
|
import androidx.compose.material.icons.filled.ArrowDropDown
|
||||||
@ -14,11 +13,13 @@ import androidx.compose.runtime.*
|
|||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.ExperimentalComposeUiApi
|
import androidx.compose.ui.ExperimentalComposeUiApi
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.graphics.ColorFilter
|
import androidx.compose.ui.graphics.ColorFilter
|
||||||
import androidx.compose.ui.graphics.painter.Painter
|
import androidx.compose.ui.graphics.painter.Painter
|
||||||
import androidx.compose.ui.input.pointer.PointerIconDefaults
|
import androidx.compose.ui.input.pointer.PointerIconDefaults
|
||||||
import androidx.compose.ui.input.pointer.pointerHoverIcon
|
import androidx.compose.ui.input.pointer.pointerHoverIcon
|
||||||
import androidx.compose.ui.res.painterResource
|
import androidx.compose.ui.res.painterResource
|
||||||
|
import androidx.compose.ui.text.style.TextAlign
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import com.jetpackduba.gitnuro.extensions.handMouseClickable
|
import com.jetpackduba.gitnuro.extensions.handMouseClickable
|
||||||
import com.jetpackduba.gitnuro.extensions.ignoreKeyEvents
|
import com.jetpackduba.gitnuro.extensions.ignoreKeyEvents
|
||||||
@ -158,32 +159,31 @@ fun MenuButton(
|
|||||||
MaterialTheme.colors.secondaryVariant //todo this color isn't specified anywhere
|
MaterialTheme.colors.secondaryVariant //todo this color isn't specified anywhere
|
||||||
}
|
}
|
||||||
|
|
||||||
Box(
|
Column(
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
.handMouseClickable { if (enabled) onClick() }
|
|
||||||
.border(ButtonDefaults.outlinedBorder, RoundedCornerShape(4.dp))
|
|
||||||
.ignoreKeyEvents()
|
.ignoreKeyEvents()
|
||||||
.padding(vertical = 8.dp, horizontal = 16.dp),
|
.handMouseClickable { if (enabled) onClick() }
|
||||||
) {
|
.padding(vertical = 4.dp, horizontal = 16.dp)
|
||||||
Row(
|
.width(48.dp),
|
||||||
horizontalArrangement = Arrangement.Center,
|
horizontalAlignment = Alignment.CenterHorizontally,
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalArrangement = Arrangement.Center,
|
||||||
) {
|
) {
|
||||||
Image(
|
Image(
|
||||||
painter = icon,
|
painter = icon,
|
||||||
contentDescription = title,
|
contentDescription = title,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.padding(horizontal = 4.dp)
|
.padding(vertical = 2.dp)
|
||||||
.size(24.dp),
|
.size(24.dp),
|
||||||
colorFilter = ColorFilter.tint(iconColor),
|
colorFilter = ColorFilter.tint(iconColor),
|
||||||
)
|
)
|
||||||
Text(
|
Text(
|
||||||
text = title,
|
text = title,
|
||||||
style = MaterialTheme.typography.body2,
|
style = MaterialTheme.typography.body2,
|
||||||
|
maxLines = 1,
|
||||||
|
textAlign = TextAlign.Center,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun ExtendedMenuButton(
|
fun ExtendedMenuButton(
|
||||||
@ -202,21 +202,24 @@ fun ExtendedMenuButton(
|
|||||||
|
|
||||||
var showDropDownMenu by remember { mutableStateOf(false) }
|
var showDropDownMenu by remember { mutableStateOf(false) }
|
||||||
|
|
||||||
Row(modifier = modifier.height(IntrinsicSize.Min)) {
|
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier
|
modifier = modifier
|
||||||
|
.height(IntrinsicSize.Min)
|
||||||
.ignoreKeyEvents()
|
.ignoreKeyEvents()
|
||||||
.handMouseClickable { if (enabled) onClick() }
|
.handMouseClickable { if (enabled) onClick() }
|
||||||
.border(ButtonDefaults.outlinedBorder, RoundedCornerShape(topStart = 4.dp, bottomStart = 4.dp))
|
) {
|
||||||
.padding(vertical = 8.dp, horizontal = 16.dp),
|
Column(
|
||||||
horizontalArrangement = Arrangement.Center,
|
modifier = Modifier
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
.padding(top = 4.dp, bottom = 4.dp, start = 16.dp, end = 4.dp)
|
||||||
|
.width(40.dp),
|
||||||
|
horizontalAlignment = Alignment.CenterHorizontally,
|
||||||
|
verticalArrangement = Arrangement.Center,
|
||||||
) {
|
) {
|
||||||
Image(
|
Image(
|
||||||
painter = icon,
|
painter = icon,
|
||||||
contentDescription = title,
|
contentDescription = title,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.padding(horizontal = 4.dp)
|
.padding(vertical = 2.dp)
|
||||||
.size(24.dp),
|
.size(24.dp),
|
||||||
colorFilter = ColorFilter.tint(iconColor),
|
colorFilter = ColorFilter.tint(iconColor),
|
||||||
)
|
)
|
||||||
@ -231,7 +234,6 @@ fun ExtendedMenuButton(
|
|||||||
.width(20.dp)
|
.width(20.dp)
|
||||||
.fillMaxHeight()
|
.fillMaxHeight()
|
||||||
.ignoreKeyEvents()
|
.ignoreKeyEvents()
|
||||||
.border(ButtonDefaults.outlinedBorder, RoundedCornerShape(topEnd = 4.dp, bottomEnd = 4.dp))
|
|
||||||
.handMouseClickable {
|
.handMouseClickable {
|
||||||
showDropDownMenu = true
|
showDropDownMenu = true
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user