mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-12-06 04:55:44 +00:00
Scroll new controller prompts fully into view
This commit is contained in:
1 parent
93709144b9
commit
d1cc4f5fa3
2 files changed
+10
-3
No files matched your search
@@ -7,11 +7,14 @@ import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.relocation.BringIntoViewRequester
|
||||
import androidx.compose.foundation.relocation.bringIntoViewRequester
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Surface
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.layout.onGloballyPositioned
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.platform.testTag
|
||||
import androidx.compose.ui.res.stringResource
|
||||
@@ -135,8 +138,12 @@ internal fun DrawerInputPrompt(
|
||||
cancelModifier: Modifier = Modifier,
|
||||
content: @Composable () -> Unit,
|
||||
) {
|
||||
Surface(modifier = Modifier.fillMaxWidth().padding(vertical = 6.dp), shape = MaterialTheme.shapes.medium,
|
||||
tonalElevation = 3.dp) {
|
||||
val reveal = remember { BringIntoViewRequester() }
|
||||
var positioned by remember { mutableStateOf(false) }
|
||||
LaunchedEffect(positioned) { if (positioned) reveal.bringIntoView() }
|
||||
Surface(modifier = Modifier.fillMaxWidth().padding(vertical = 6.dp)
|
||||
.bringIntoViewRequester(reveal).onGloballyPositioned { positioned = true },
|
||||
shape = MaterialTheme.shapes.medium, tonalElevation = 3.dp) {
|
||||
Column(Modifier.padding(12.dp), verticalArrangement = Arrangement.spacedBy(6.dp)) {
|
||||
Text(title, style = MaterialTheme.typography.titleSmall)
|
||||
content()
|
||||
|
||||
@@ -72,7 +72,7 @@ class InputUiLayoutTest {
|
||||
compose.onNodeWithTag("input-save-combination").performScrollTo().performClick()
|
||||
val confirm = compose.onNode(hasTestTag("input-save-combination-confirm") and
|
||||
hasAnyAncestor(hasTestTag("drawer-window")))
|
||||
confirm.performScrollTo().assertIsNotEnabled()
|
||||
confirm.assertIsDisplayed().assertIsNotEnabled()
|
||||
compose.onNodeWithTag("input-save-combination-name").performScrollTo().performTextInput("Drawer mix")
|
||||
confirm.performScrollTo().assertIsEnabled().performClick()
|
||||
compose.runOnIdle { assertEquals("Drawer mix", saved.profile(saved.activeId(false)).name) }
|
||||
|
||||
Reference in new issue
Block a user