mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-25 07:46:01 +00:00
fix(ui): raise buttons, chips and tabs to handheld touch sizes
This commit is contained in:
3 files changed
+10
-6
No files matched your search
@@ -111,7 +111,7 @@ internal fun BackLink(label: String, compact: Boolean = false, onClick: () -> Un
|
|||||||
val shape = RoundedCornerShape(22.dp)
|
val shape = RoundedCornerShape(22.dp)
|
||||||
Row(
|
Row(
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
modifier = Modifier.paneItem("back:$label").heightIn(min = if (compact) 36.dp else 44.dp)
|
modifier = Modifier.paneItem("back:$label").heightIn(min = if (compact) 44.dp else 48.dp)
|
||||||
.clip(shape)
|
.clip(shape)
|
||||||
.background(if (hot) pal.signal.copy(alpha = 0.14f) else Color.White.copy(alpha = 0.04f))
|
.background(if (hot) pal.signal.copy(alpha = 0.14f) else Color.White.copy(alpha = 0.04f))
|
||||||
.border(2.dp, if (hot) pal.signal else Color.Transparent, shape)
|
.border(2.dp, if (hot) pal.signal else Color.Transparent, shape)
|
||||||
@@ -166,6 +166,8 @@ internal fun PrimaryButton(
|
|||||||
Row(
|
Row(
|
||||||
verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(8.dp),
|
verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(8.dp),
|
||||||
modifier = modifier.then(track)
|
modifier = modifier.then(track)
|
||||||
|
// 48dp to touch on a handheld; compact rows keep 44.
|
||||||
|
.heightIn(min = if (compact) 44.dp else 48.dp)
|
||||||
.then(if (frontFocus != null) Modifier.focusRequester(frontFocus.primary).onFocusChanged { if (it.isFocused) frontFocus.last = FrontFocus.PRIMARY } else Modifier)
|
.then(if (frontFocus != null) Modifier.focusRequester(frontFocus.primary).onFocusChanged { if (it.isFocused) frontFocus.last = FrontFocus.PRIMARY } else Modifier)
|
||||||
.graphicsLayer { scaleX = scale; scaleY = scale; shadowElevation = if (enabled) lift.dp.toPx() else 0f; shape = Shape12; clip = false; ambientShadowColor = pal.signal; spotShadowColor = pal.signal }
|
.graphicsLayer { scaleX = scale; scaleY = scale; shadowElevation = if (enabled) lift.dp.toPx() else 0f; shape = Shape12; clip = false; ambientShadowColor = pal.signal; spotShadowColor = pal.signal }
|
||||||
.clip(Shape12)
|
.clip(Shape12)
|
||||||
@@ -202,7 +204,8 @@ internal fun SecondaryButton(text: String, enabled: Boolean = true, compact: Boo
|
|||||||
val edge by animateColorAsState(if (hot) pal.signal else pal.line2, Motion.tw(250), label = "secEdge")
|
val edge by animateColorAsState(if (hot) pal.signal else pal.line2, Motion.tw(250), label = "secEdge")
|
||||||
val fill by animateColorAsState(if (hot) pal.signal.copy(alpha = 0.14f) else Color.White.copy(alpha = 0.03f), Motion.tw(250), label = "secFill")
|
val fill by animateColorAsState(if (hot) pal.signal.copy(alpha = 0.14f) else Color.White.copy(alpha = 0.03f), Motion.tw(250), label = "secFill")
|
||||||
Box(
|
Box(
|
||||||
modifier = modifier.paneItem("btn:$text").downToFirstTile().graphicsLayer { scaleX = scale; scaleY = scale }.clip(Shape12).background(fill).border(1.dp, edge, Shape12)
|
contentAlignment = Alignment.Center,
|
||||||
|
modifier = modifier.paneItem("btn:$text").downToFirstTile().heightIn(min = if (compact) 44.dp else 48.dp).graphicsLayer { scaleX = scale; scaleY = scale }.clip(Shape12).background(fill).border(1.dp, edge, Shape12)
|
||||||
.alpha(if (enabled) 1f else 0.5f)
|
.alpha(if (enabled) 1f else 0.5f)
|
||||||
.hoverable(src).clickable(interactionSource = src, indication = LocalIndication.current, enabled = enabled, onClick = onClick)
|
.hoverable(src).clickable(interactionSource = src, indication = LocalIndication.current, enabled = enabled, onClick = onClick)
|
||||||
.controllerConfirm(enabled = enabled, onClick = onClick)
|
.controllerConfirm(enabled = enabled, onClick = onClick)
|
||||||
@@ -211,7 +214,7 @@ internal fun SecondaryButton(text: String, enabled: Boolean = true, compact: Boo
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
internal fun Cog(size: androidx.compose.ui.unit.Dp = 42.dp, onClick: () -> Unit) {
|
internal fun Cog(size: androidx.compose.ui.unit.Dp = 48.dp, onClick: () -> Unit) {
|
||||||
val colors = MaterialTheme.colorScheme
|
val colors = MaterialTheme.colorScheme
|
||||||
val src = remember { MutableInteractionSource() }
|
val src = remember { MutableInteractionSource() }
|
||||||
val hot = rememberHot(src)
|
val hot = rememberHot(src)
|
||||||
|
|||||||
@@ -349,10 +349,10 @@ fun SessionDrawer(open: Boolean, page: Int, controllerActive: Boolean, onPageCha
|
|||||||
}
|
}
|
||||||
SettingsGroup("Keyboard") {
|
SettingsGroup("Keyboard") {
|
||||||
Row(horizontalArrangement = Arrangement.spacedBy(8.dp), modifier = Modifier.fillMaxWidth().padding(8.dp)) {
|
Row(horizontalArrangement = Arrangement.spacedBy(8.dp), modifier = Modifier.fillMaxWidth().padding(8.dp)) {
|
||||||
DrawerOutlineButton("Hardware", modifier = Modifier.weight(1f).height(42.dp).then(focus.track(page, "hardware"))) {
|
DrawerOutlineButton("Hardware", modifier = Modifier.weight(1f).height(48.dp).then(focus.track(page, "hardware"))) {
|
||||||
host.open = null; a.onHardwareKeyboard()
|
host.open = null; a.onHardwareKeyboard()
|
||||||
}
|
}
|
||||||
DrawerOutlineButton("Android", modifier = Modifier.weight(1f).height(42.dp).then(focus.track(page, "android"))) {
|
DrawerOutlineButton("Android", modifier = Modifier.weight(1f).height(48.dp).then(focus.track(page, "android"))) {
|
||||||
host.open = null; a.onKeyboard()
|
host.open = null; a.onKeyboard()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ internal fun TabStrip(
|
|||||||
.border(2.dp, if (!hot) Color.Transparent else if (on) colors.onBackground else pal.signal, tabShape)
|
.border(2.dp, if (!hot) Color.Transparent else if (on) colors.onBackground else pal.signal, tabShape)
|
||||||
.hoverable(src).clickable(interactionSource = src, indication = null, role = Role.Tab, onClick = pick)
|
.hoverable(src).clickable(interactionSource = src, indication = null, role = Role.Tab, onClick = pick)
|
||||||
.controllerConfirm(onClick = pick)
|
.controllerConfirm(onClick = pick)
|
||||||
.padding(horizontal = 16.dp, vertical = 9.dp),
|
.padding(horizontal = 16.dp, vertical = 12.dp),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -303,6 +303,7 @@ fun ValueChip(text: String, open: Boolean, enabled: Boolean = true, modifier: Mo
|
|||||||
verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.SpaceBetween,
|
verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.SpaceBetween,
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
.widthIn(min = LocalChipMinWidth.current)
|
.widthIn(min = LocalChipMinWidth.current)
|
||||||
|
.heightIn(min = 44.dp)
|
||||||
.clip(RoundedCornerShape(10.dp))
|
.clip(RoundedCornerShape(10.dp))
|
||||||
.background(colors.surfaceVariant)
|
.background(colors.surfaceVariant)
|
||||||
.border(1.dp, edge, RoundedCornerShape(10.dp))
|
.border(1.dp, edge, RoundedCornerShape(10.dp))
|
||||||
|
|||||||
Reference in new issue
Block a user