Improve dialogs and update accompanist

This commit is contained in:
Syer10
2022-03-03 14:49:03 -05:00
parent a2247cfa1e
commit 6c32c59579
2 changed files with 26 additions and 19 deletions

View File

@@ -9,9 +9,9 @@ xmlUtil = "0.84.0"
# Compose
voyager = "1.0.0-beta16"
accompanist = "0.20.1"
accompanist = "0.24.4"
kamel = "0.3.0"
materialDialogs = "0.6.4"
materialDialogs = "0.6.6"
# Android
core = "1.7.0"

View File

@@ -32,7 +32,6 @@ import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.defaultMinSize
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
@@ -274,15 +273,19 @@ fun <T> ChoiceDialog(
title(title)
Box {
val listState = rememberLazyListState()
LazyColumn(Modifier.fillMaxSize(), listState) {
LazyColumn(Modifier.defaultMinSize(minHeight = 64.dp).fillMaxWidth(), listState) {
items(items) { (value, text) ->
Row(
modifier = Modifier.requiredHeight(48.dp).fillMaxWidth().clickable(
modifier = Modifier
.requiredHeight(48.dp)
.fillMaxWidth()
.clickable(
onClick = {
onSelected(value)
state.hide()
}
),
)
.padding(horizontal = 8.dp),
verticalAlignment = Alignment.CenterVertically
) {
RadioButton(
@@ -333,10 +336,13 @@ fun <T> MultiSelectDialog(
title(title)
val listState = rememberLazyListState()
Box {
LazyColumn(Modifier.fillMaxSize(), listState) {
LazyColumn(Modifier.defaultMinSize(minHeight = 64.dp).fillMaxWidth(), listState) {
items(items) { (value, text) ->
Row(
modifier = Modifier.requiredHeight(48.dp).fillMaxWidth().clickable(
modifier = Modifier
.requiredHeight(48.dp)
.fillMaxWidth()
.clickable(
onClick = {
if (value in checked) {
checked -= value
@@ -344,7 +350,8 @@ fun <T> MultiSelectDialog(
checked += value
}
}
),
)
.padding(horizontal = 8.dp),
verticalAlignment = Alignment.CenterVertically
) {
Checkbox(