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 # Compose
voyager = "1.0.0-beta16" voyager = "1.0.0-beta16"
accompanist = "0.20.1" accompanist = "0.24.4"
kamel = "0.3.0" kamel = "0.3.0"
materialDialogs = "0.6.4" materialDialogs = "0.6.6"
# Android # Android
core = "1.7.0" 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.Spacer
import androidx.compose.foundation.layout.defaultMinSize import androidx.compose.foundation.layout.defaultMinSize
import androidx.compose.foundation.layout.fillMaxHeight import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
@@ -274,15 +273,19 @@ fun <T> ChoiceDialog(
title(title) title(title)
Box { Box {
val listState = rememberLazyListState() val listState = rememberLazyListState()
LazyColumn(Modifier.fillMaxSize(), listState) { LazyColumn(Modifier.defaultMinSize(minHeight = 64.dp).fillMaxWidth(), listState) {
items(items) { (value, text) -> items(items) { (value, text) ->
Row( Row(
modifier = Modifier.requiredHeight(48.dp).fillMaxWidth().clickable( modifier = Modifier
.requiredHeight(48.dp)
.fillMaxWidth()
.clickable(
onClick = { onClick = {
onSelected(value) onSelected(value)
state.hide() state.hide()
} }
), )
.padding(horizontal = 8.dp),
verticalAlignment = Alignment.CenterVertically verticalAlignment = Alignment.CenterVertically
) { ) {
RadioButton( RadioButton(
@@ -333,10 +336,13 @@ fun <T> MultiSelectDialog(
title(title) title(title)
val listState = rememberLazyListState() val listState = rememberLazyListState()
Box { Box {
LazyColumn(Modifier.fillMaxSize(), listState) { LazyColumn(Modifier.defaultMinSize(minHeight = 64.dp).fillMaxWidth(), listState) {
items(items) { (value, text) -> items(items) { (value, text) ->
Row( Row(
modifier = Modifier.requiredHeight(48.dp).fillMaxWidth().clickable( modifier = Modifier
.requiredHeight(48.dp)
.fillMaxWidth()
.clickable(
onClick = { onClick = {
if (value in checked) { if (value in checked) {
checked -= value checked -= value
@@ -344,7 +350,8 @@ fun <T> MultiSelectDialog(
checked += value checked += value
} }
} }
), )
.padding(horizontal = 8.dp),
verticalAlignment = Alignment.CenterVertically verticalAlignment = Alignment.CenterVertically
) { ) {
Checkbox( Checkbox(