Why does it look like that? (Thread)
# compose
j
Why does it look like that? (Thread)
Code:
Copy code
Dialog(onDismissRequest = { barCodeVal = "" }) {
    val product = produceState<ProductInfo?>(null) {
        value = productInfoRepository.getProductByBarCode(barCodeVal)
    }
    if(product.value == null) {
        CircularProgressIndicator()
    } else {
        ProductInfoCard(product.value!!)
    }
}
//
@Composable
fun ProductInfoCard(product: ProductInfo) {
    Row(modifier = Modifier.fillMaxSize()) {
        /*Box {
            AsyncImage(product.imageUrl, product.name, modifier = Modifier
                .scale(3f).clip(RoundedCornerShape(20)))
        }*/
        Text(product.name, color = Color.Red, modifier = Modifier.padding(horizontal = 10.dp))
    }
}
s
I faced this one yesterday. It looks like dialogs can't resize theirselves. (So, the dialog keeps the needed size to wrap the
CircularProgressIndicator
). Solution 1):
Copy code
Dialog(
    properties = DialogProperties(
        usePlatformDefaultWidth = false
    )
)
Solution 2): Set a fixed width via a modifier
j
ohh weird thanks