Make LongPressMenu scrollable if it does not fit on screen

This commit is contained in:
Stypox 2026-02-08 15:36:33 +01:00
parent a92c8b2243
commit 2a28e7a805
No known key found for this signature in database
GPG Key ID: 4BDF1B40A49FDD23

View File

@ -28,8 +28,10 @@ import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.widthIn
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.text.InlineTextContent
import androidx.compose.foundation.text.appendInlineContent
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.filled.OpenInNew
import androidx.compose.material.icons.automirrored.filled.PlaylistPlay
@ -242,8 +244,12 @@ private fun LongPressMenuContent(
// width for the landscape/reduced header, measured in button widths
val headerWidthInButtonsReducedSpan = 4
val buttonsPerRow = (this.maxWidth / MinButtonWidth).toInt()
val scrollState = rememberScrollState()
Column {
Column(
modifier = Modifier
.verticalScroll(scrollState)
) {
var actionIndex = if (header != null) -1 else 0 // -1 indicates the header
while (actionIndex < actions.size) {
Row(