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

View File

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