Don't make bottom sheet content scrollable per default
This commit is contained in:
parent
02d45a63fc
commit
e565780015
@ -4,6 +4,8 @@ import android.net.Uri
|
||||
import android.text.format.DateUtils
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.rounded.*
|
||||
import androidx.compose.material3.*
|
||||
@ -73,6 +75,12 @@ fun RestoreBackupSheet(
|
||||
}
|
||||
}
|
||||
} else null
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.wrapContentHeight()
|
||||
.verticalScroll(rememberScrollState())
|
||||
) {
|
||||
when (state) {
|
||||
RestoreBackupState.Parsing -> {
|
||||
@ -145,7 +153,9 @@ fun RestoreBackupSheet(
|
||||
style = MaterialTheme.typography.titleSmall,
|
||||
modifier = Modifier.padding(top = 8.dp, bottom = 4.dp)
|
||||
)
|
||||
val components by viewModel.availableComponents.observeAsState(emptyList())
|
||||
val components by viewModel.availableComponents.observeAsState(
|
||||
emptyList()
|
||||
)
|
||||
for (component in components) {
|
||||
Row(
|
||||
modifier = Modifier
|
||||
@ -218,3 +228,4 @@ fun RestoreBackupSheet(
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package de.mm20.launcher2.ui.component
|
||||
|
||||
import androidx.compose.animation.animateContentSize
|
||||
import androidx.compose.animation.core.animateDpAsState
|
||||
import androidx.compose.foundation.gestures.Orientation
|
||||
import androidx.compose.foundation.layout.*
|
||||
@ -39,8 +40,6 @@ fun BottomSheetDialog(
|
||||
dismissButton: @Composable (() -> Unit)? = null,
|
||||
content: @Composable () -> Unit,
|
||||
) {
|
||||
val scrollState = rememberScrollState()
|
||||
|
||||
val swipeState = remember {
|
||||
SwipeableState(
|
||||
initialValue = SwipeState.Dismiss,
|
||||
@ -151,7 +150,7 @@ fun BottomSheetDialog(
|
||||
},
|
||||
resistance = null
|
||||
)
|
||||
//.animateContentSize()
|
||||
.animateContentSize()
|
||||
.onSizeChanged {
|
||||
height = it.height.toFloat()
|
||||
}
|
||||
@ -172,7 +171,6 @@ fun BottomSheetDialog(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.wrapContentHeight()
|
||||
.verticalScroll(scrollState)
|
||||
.padding(horizontal = 24.dp, vertical = 8.dp),
|
||||
propagateMinConstraints = true,
|
||||
contentAlignment = Alignment.Center
|
||||
|
||||
@ -4,6 +4,8 @@ import androidx.activity.compose.rememberLauncherForActivityResult
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.rounded.*
|
||||
import androidx.compose.material3.*
|
||||
@ -47,7 +49,8 @@ fun CreateBackupSheet(
|
||||
}
|
||||
)
|
||||
|
||||
BottomSheetDialog(onDismissRequest = onDismissRequest,
|
||||
BottomSheetDialog(
|
||||
onDismissRequest = onDismissRequest,
|
||||
title = {
|
||||
Text(
|
||||
stringResource(id = R.string.preference_backup),
|
||||
@ -75,13 +78,21 @@ fun CreateBackupSheet(
|
||||
}
|
||||
}
|
||||
},
|
||||
dismissButton = if (state == CreateBackupState.Ready) {{
|
||||
dismissButton = if (state == CreateBackupState.Ready) {
|
||||
{
|
||||
OutlinedButton(
|
||||
onClick = onDismissRequest
|
||||
) {
|
||||
Text(stringResource(android.R.string.cancel))
|
||||
}
|
||||
}} else null
|
||||
}
|
||||
} else null
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.wrapContentHeight()
|
||||
.verticalScroll(rememberScrollState())
|
||||
) {
|
||||
when (state) {
|
||||
CreateBackupState.Ready -> {
|
||||
@ -154,6 +165,7 @@ fun CreateBackupSheet(
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user