Remove ConstraintLayout from compose

This commit is contained in:
Ensar Sarajčić 2023-10-02 17:08:28 +02:00
parent 0767d76345
commit e111bce5f2
2 changed files with 7 additions and 25 deletions

View File

@ -17,7 +17,6 @@ import androidx.compose.ui.res.colorResource
import androidx.compose.ui.res.dimensionResource
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.constraintlayout.compose.ConstraintLayout
import com.simplemobiletools.commons.compose.extensions.MyDevices
import com.simplemobiletools.commons.compose.theme.AppThemeSurface
import com.simplemobiletools.commons.extensions.adjustAlpha
@ -32,21 +31,16 @@ internal fun WidgetConfigureScreen(
onColorPressed: () -> Unit,
onSavePressed: () -> Unit
) {
ConstraintLayout(
modifier = Modifier.fillMaxSize()
Column(
modifier = Modifier.fillMaxSize(),
verticalArrangement = Arrangement.Bottom,
) {
val (brightDisplay, bottomControls, saveButton) = createRefs()
Box(
modifier = Modifier
.padding(dimensionResource(id = R.dimen.activity_margin))
.padding(bottom = dimensionResource(id = R.dimen.activity_margin))
.constrainAs(brightDisplay) {
top.linkTo(parent.top)
end.linkTo(parent.end)
start.linkTo(parent.start)
bottom.linkTo(bottomControls.top)
}
.fillMaxWidth()
.weight(1f)
) {
Icon(
modifier = Modifier
@ -58,13 +52,7 @@ internal fun WidgetConfigureScreen(
)
}
Row(
modifier = Modifier.constrainAs(bottomControls) {
bottom.linkTo(saveButton.top)
start.linkTo(parent.start)
end.linkTo(parent.end)
}
) {
Row {
Icon(
modifier = Modifier
.size(dimensionResource(id = R.dimen.widget_colorpicker_size))
@ -90,10 +78,7 @@ internal fun WidgetConfigureScreen(
}
Button(
modifier = Modifier.constrainAs(saveButton) {
end.linkTo(parent.end)
bottom.linkTo(parent.bottom)
},
modifier = Modifier.align(Alignment.End),
onClick = onSavePressed
) {
Text(text = stringResource(id = R.string.ok))

View File

@ -15,7 +15,6 @@ composeActivity = "1.8.0-rc01"
compose = "1.6.0-alpha06"
composeCompiler = "1.5.3"
composeMaterial3 = "1.2.0-alpha08"
composeConstraintLayout = "1.0.1"
#Gradle
gradlePlugins-agp = "8.1.1"
#build
@ -45,7 +44,6 @@ simple-tools-commons = { module = "com.github.SimpleMobileTools:Simple-Commons",
#Compose
compose-compiler = { module = "androidx.compose.compiler:compiler", version.ref = "composeCompiler" }
compose-foundation = { module = "androidx.compose.foundation:foundation", version.ref = "compose" }
compose-constraintlayout = { module = "androidx.constraintlayout:constraintlayout-compose", version.ref = "composeConstraintLayout" }
compose-material3 = { module = "androidx.compose.material3:material3", version.ref = "composeMaterial3" }
compose-material2 = { module = "androidx.compose.material:material", version.ref = "compose" }
compose-material-icons = { module = "androidx.compose.material:material-icons-extended", version.ref = "compose" }
@ -63,7 +61,6 @@ compose = [
"compose-foundation",
"compose-material-icons",
"compose-material3",
"compose-constraintlayout",
"compose-runtime",
"compose-ui",
"compose-uiTooling-preview",