title: Weights for Constraint Layout in Jetpack Compose
body: <p>Is there any way to use weights in <strong>Jetpack Compose</strong> ConstraintLayout chains like in XML:</p>
  <pre class="lang-xml prettyprint-override"><code>&lt;android.support.constraint.ConstraintLayout
      xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot;
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;match_parent&quot;&gt;
  
      &lt;View
          android:id=&quot;@+id/first&quot;
          android:layout_width=&quot;0dp&quot;
          android:layout_height=&quot;48dp&quot;
          android:background=&quot;#caf&quot;
          app:layout_constraintLeft_toLeftOf=&quot;parent&quot;
          app:layout_constraintRight_toLeftOf=&quot;@+id/start&quot;
          app:layout_constraintHorizontal_weight=&quot;6&quot;/&gt;
  
      &lt;View
          android:id=&quot;@+id/second&quot;
          android:layout_width=&quot;0dp&quot;
          android:layout_height=&quot;48dp&quot;
          android:background=&quot;#fac&quot;
          app:layout_constraintLeft_toRightOf=&quot;@+id/first&quot;
          app:layout_constraintRight_toRightOf=&quot;parent&quot;
          app:layout_constraintHorizontal_weight=&quot;4&quot;/&gt;
  
  &lt;/android.support.constraint.ConstraintLayout&gt;
  
  </code></pre>
  <p>Currently, neither <code>ConstraintLayoutScope</code> or <code>ConstraintScope</code> provide weight functionality. <code>ConstraintLayoutScope</code> provides <code>createHorizontalChain(vararg elements: ConstraintLayoutReference, chainStyle: ChainStyle)</code> (or <code>createVerticalChain</code> respectively) but without the option to set weights to individual elements.</p>
  <p>With guidelines, barriers and everything else integrated I feel like there's something important missing here. Is there a way to use weights in chains or emulate their behaviour? I cannot just specify a fixed width for a element since the width of the ConstraintLayout has to match the whole screen.</p>
  <p><em>Note: I understand that the new Jetpack Compose ConstraintLayout does not have a performance advantage for complex, otherwise nested, layout structures like the Android View ConstraintLayout had. I’m also aware that Row and Column provide weight functionality but I have to use ConstraintLayout in my case (<a href="https://stackoverflow.com/questions/65570024/jetpack-compose-overlays-build-software-keyboard-with-jetpack-compose">reason</a>)</em></p>