Sergey Y.
10/25/2021, 9:41 AMline 157
, I saw the comment "Don't do this."
But why? I know that .onSizeChanged
will only fire after the first composition, and we have to wait to get the required attribute.
This seems acceptable to me.
What other ways can we get the attributes of the child layout besides writing a custom layout using Layout
composable or Modifier.layout
?
https://android-review.googlesource.com/c/platform/frameworks/support/+/1856275/7/compose/in[…]va/androidx/compose/integration/docs/phases/Phases.ktAlbert Chang
10/25/2021, 1:25 PMAdam Powell
10/25/2021, 1:58 PMSergey Y.
10/25/2021, 2:23 PMCoil
under the hud. It takes a URL
of an image is required to show.
I have a Coil
image painter and a regular Image(painter = ...)
widget inside my wrapper function.
Also, I am using Modifier.onSizeChanged
to get the widget's size and pass it to the Coil
Image Request Builder to specify the width and height of the image to load (I also reduced its size slightly).
Is this considered a sub-optimal solution?
I cannot specify strict dimensions for the image widget of my application because it is used throughout the application and has dynamic dimensions, usually filling a parent size.Adam Powell
10/25/2021, 3:26 PMCoilImage
had some of this built-in. You want to avoid using the dimensions to construct the painter, you want to inform the painter of the dimensions once you know them, which should signal the load.Adam Powell
10/25/2021, 3:28 PMjava.net.URL
for anything ever. Here's why: https://docs.oracle.com/javase/7/docs/api/java/net/URL.html#equals(java.lang.Object) its .equals
method is defined to perform blocking DNS lookup in order to compare if the hosts in two URLs are the same.Sergey Y.
10/25/2021, 6:34 PM