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