How would i let the row with the buttons match the...
# compose
d
How would i let the row with the buttons match the width of the column without
fillMaxWidth()
because that would expand the column. The column doesn't have a fixed size. This is my code:
Copy code
Box(propagateMinConstraints = true) {
                Column(Modifier.wrapContentWidth().padding(24.dp).background(Color.Green.copy(alpha = 0.5f))) {
                    Row(Modifier) {
                        CompositionLocalProvider(Material3TextStyle provides MaterialTheme3.typography.headlineMedium) {
                            title()
                        }
                    }
                    Spacer(Modifier.height(32.dp))

                    Box {
                        //rowConstraints = constraints
                        CompositionLocalProvider(Material3TextStyle provides MaterialTheme3.typography.bodyLarge) {
                            Column(verticalArrangement = Arrangement.Center) {
                                content()
                            }
                        }
                    }
                    Spacer(Modifier.height(32.dp))
                    Row(
                        Modifier.background(Color.Red.copy(alpha = 0.4f)),
                        horizontalArrangement = Arrangement.spacedBy(8.dp, Alignment.End)
                    ) {
                        dismissButton(scope)
                        confirmButton(scope)
                    }
                }
            }
🧵 1
🧵 3
c
People are using the 🧵emoji in order to ask you to move the bulk of your question into a thread. See: https://kotlinlang.slack.com/archives/CJLTWPH7S/p1616265877303000
I think what you want here is Intrinsics. I think you would set a width of Intrinsic.Min on the layout that contains the input field and buttons. and then on the buttons you can set fillMaxWidth (or maybe even weight(1f) and then it shouldn't increase the width. The docs here have a good example of how intrinsics work. https://developer.android.com/jetpack/compose/layouts/intrinsic-measurements
d
This is the code:
Copy code
Box(propagateMinConstraints = true) {
                Column(Modifier.wrapContentWidth().padding(24.dp).background(Color.Green.copy(alpha = 0.5f))) {
                    Row(Modifier) {
                        CompositionLocalProvider(Material3TextStyle provides MaterialTheme3.typography.headlineMedium) {
                            title()
                        }
                    }
                    Spacer(Modifier.height(32.dp))

                    Box {
                        //rowConstraints = constraints
                        CompositionLocalProvider(Material3TextStyle provides MaterialTheme3.typography.bodyLarge) {
                            Column(verticalArrangement = Arrangement.Center) {
                                content()
                            }
                        }
                    }
                    Spacer(Modifier.height(32.dp))
                    Row(
                        Modifier.background(Color.Red.copy(alpha = 0.4f)),
                        horizontalArrangement = Arrangement.spacedBy(8.dp, Alignment.End)
                    ) {
                        dismissButton(scope)
                        confirmButton(scope)
                    }
                }
            }
@Colton Idle Thank you that solved my problem
c
Awesome!