https://kotlinlang.org logo
#compose
Title
# compose
k

Kshitij Patil

12/03/2020, 4:34 PM
@cb how can I make Glide/Coil image
fillMaxWidh()
? Seems like
preferredSize()
is a compulsory step to do.
c

cb

12/03/2020, 4:40 PM
Can you post an example layout which isn’t working?
k

Kshitij Patil

12/04/2020, 6:38 AM
Copy code
GlideImage(
    data = imagePath, // imageUri not working?
    fadeIn = true,
    modifier = Modifier
        .preferredSize(192.dp)
        .fillMaxWidth()
        .constrainAs(image) {
            top.linkTo(dateTime.bottom, margin = 8.dp)
            start.linkTo(parent.start, margin = 8.dp)
        }
)
If I remove
preferredSize
, image isn't shown at all. I want images to have fixed height and stretched across width. Also,
imageUri
is not working whereas
imageUri.path
works, is that an issue with Glide itself?
c

cb

12/04/2020, 8:46 AM
What is
imagePath
? If it's not a type which Glide understands then you need to convert it to something which it does.
I'll take a look at the size thing. Pretty sure we have a test for this but I'll check
k

Kshitij Patil

12/04/2020, 9:09 AM
imagePath
is
imageUri.path
, so my issue is Glide works with image path but AFAIK Glide supports both
c

cb

12/07/2020, 9:45 AM
The data is passed directly to Glide. If it's not loading, it's either an issue in Glide, or you should provide your own mapper
As to the size issue, can you post the wider layout (including the ConstraintLayout)?