Merge pull request #178 from frenzydrive/fix-landscape-vk-hashes-dialog
Fix VK hashes dialog on landscape screens
This commit is contained in:
commit
3c59ab01f7
1 file changed
+44
-25
@@ -994,15 +994,26 @@ fun HashesDialog(
|
|||||||
var h3 by remember { mutableStateOf(hash3) }
|
var h3 by remember { mutableStateOf(hash3) }
|
||||||
var h4 by remember { mutableStateOf(hash4) }
|
var h4 by remember { mutableStateOf(hash4) }
|
||||||
|
|
||||||
Dialog(onDismissRequest = onDismiss) {
|
Dialog(
|
||||||
|
onDismissRequest = onDismiss,
|
||||||
|
properties = DialogProperties(usePlatformDefaultWidth = false)
|
||||||
|
) {
|
||||||
Surface(
|
Surface(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.fillMaxHeight(0.95f)
|
||||||
|
.imePadding()
|
||||||
|
.padding(horizontal = 16.dp, vertical = 12.dp)
|
||||||
|
.widthIn(max = 560.dp),
|
||||||
shape = RoundedCornerShape(24.dp),
|
shape = RoundedCornerShape(24.dp),
|
||||||
color = MaterialTheme.colorScheme.surface,
|
color = MaterialTheme.colorScheme.surface,
|
||||||
contentColor = MaterialTheme.colorScheme.onSurface,
|
contentColor = MaterialTheme.colorScheme.onSurface,
|
||||||
tonalElevation = 8.dp
|
tonalElevation = 8.dp
|
||||||
) {
|
) {
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier.padding(24.dp).fillMaxWidth(),
|
modifier = Modifier
|
||||||
|
.padding(24.dp)
|
||||||
|
.fillMaxWidth(),
|
||||||
verticalArrangement = Arrangement.spacedBy(12.dp)
|
verticalArrangement = Arrangement.spacedBy(12.dp)
|
||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
@@ -1027,29 +1038,37 @@ fun HashesDialog(
|
|||||||
modifier = Modifier.padding(bottom = 4.dp)
|
modifier = Modifier.padding(bottom = 4.dp)
|
||||||
)
|
)
|
||||||
|
|
||||||
listOf(
|
Column(
|
||||||
Triple("VK Хеш 1 *", h1) { v: String -> h1 = v },
|
modifier = Modifier
|
||||||
Triple("VK Хеш 2", h2) { v: String -> h2 = v },
|
.fillMaxWidth()
|
||||||
Triple("VK Хеш 3", h3) { v: String -> h3 = v },
|
.weight(1f, fill = false)
|
||||||
Triple("VK Хеш 4", h4) { v: String -> h4 = v }
|
.verticalScroll(rememberScrollState()),
|
||||||
).forEachIndexed { idx, (label, value, onChange) ->
|
verticalArrangement = Arrangement.spacedBy(12.dp)
|
||||||
val isShort = value.isNotBlank() && value.length < 16
|
) {
|
||||||
OutlinedTextField(
|
listOf(
|
||||||
value = value,
|
Triple("VK Хеш 1 *", h1) { v: String -> h1 = v },
|
||||||
onValueChange = { raw ->
|
Triple("VK Хеш 2", h2) { v: String -> h2 = v },
|
||||||
val cleaned = raw.filter { c -> c != ' ' && c != '\n' }
|
Triple("VK Хеш 3", h3) { v: String -> h3 = v },
|
||||||
onChange(stripVkUrlStatic(cleaned))
|
Triple("VK Хеш 4", h4) { v: String -> h4 = v }
|
||||||
},
|
).forEachIndexed { idx, (label, value, onChange) ->
|
||||||
label = { Text(label) },
|
val isShort = value.isNotBlank() && value.length < 16
|
||||||
placeholder = { Text("Ссылка звонка или хеш") },
|
OutlinedTextField(
|
||||||
singleLine = true,
|
value = value,
|
||||||
isError = isShort,
|
onValueChange = { raw ->
|
||||||
supportingText = if (isShort) {
|
val cleaned = raw.filter { c -> c != ' ' && c != '\n' }
|
||||||
{ Text("Хеш ${idx + 1} — короткий (мин. 16)", color = MaterialTheme.colorScheme.error) }
|
onChange(stripVkUrlStatic(cleaned))
|
||||||
} else null,
|
},
|
||||||
modifier = Modifier.fillMaxWidth(),
|
label = { Text(label) },
|
||||||
shape = RoundedCornerShape(16.dp),
|
placeholder = { Text("Ссылка звонка или хеш") },
|
||||||
)
|
singleLine = true,
|
||||||
|
isError = isShort,
|
||||||
|
supportingText = if (isShort) {
|
||||||
|
{ Text("Хеш ${idx + 1} — короткий (мин. 16)", color = MaterialTheme.colorScheme.error) }
|
||||||
|
} else null,
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
shape = RoundedCornerShape(16.dp),
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Button(
|
Button(
|
||||||
|
|||||||
Reference in new issue
Block a user