This message was deleted.
# compose-desktop
s
This message was deleted.
f
Just thinking... does the size actually change if you specify the
fillMaxSize()
Modifier?
f
The size changes , because I do specify the fraction = 0.66
So altering the size works but the println is never called
f
Well, that's the fraction of the outer composable, isn't it. Not the fraction of content. So you change the size of the outer composable? 🤔 The
animateContentSize
modifier is used when you add/remove/change content inside the composable you are using it on.
Maybe I just don't understand your usecase correctly 😅
f
well the size of the image , I’m displaying is changing according to the ratio. But the finishedListener doesn’t println and break points are not called
f
So this
sizeModifier
is used on the image?
f
on a Column
but works in a Image too
message has been deleted
Copy code
Column(modifier = Modifier.fillMaxSize(fraction = 0.66f).animateContentSize(animationSpec = twenSpec ,
    finishedListener = { initialSize: IntSize , finishedSize: IntSize  ->
        println("A $initialSize , B $finishedSize")
        println("DONE")
        //       animate = false
    } ).then(Modifier.background(Color.Green))) {
    Image(
        bitmap = img!!.asImageBitmap(),
        contentDescription = "Test Image"
    )
}
But the finishedListener not println and not breakpoints 😞
f
And how do you change the size of the image?
f
Using the modifier
I change the column size and it works
The problem is not the size of the image , it is the finishedListener which seems not to get called
f
Maybe I am just dumb but I don't see it 😄 I think that the listener is not called because the size does not actually change. Maybe you could try moving the animate modifier before the fillMaxSize modifier but other than that I don't really know, sorry
f
As you can see in the screenshots: The size is changed!
f
I can see that but I can't see how did it change from the code you posted. I'll just let someone else to answer because I am lost, sorry
f
Copy code
if (animate) {
    //    println("Animate")
    Column(modifier = Modifier.fillMaxSize(fraction = 0.66f).animateContentSize(animationSpec = twenSpec ,
        finishedListener = { initialSize: IntSize , finishedSize: IntSize  ->
            println("A $initialSize , B $finishedSize")
            println("DONE")
            //       animate = false
        } ).then(Modifier.background(Color.Green))) {
        Image(
            bitmap = img!!.asImageBitmap(),
            contentDescription = "Test Image"
        )
    }

} else {
    println("Not Animate")
    Column(modifier = Modifier.background(Color.Blue)) {
        Image(
            bitmap = img!!.asImageBitmap(),
            contentDescription = "Test Image"
        )
    }
}
I define the size with 0.66 of MaxSize and I want to animate this change
maybe that is the problem
I switched the order and some it seems that the animation is not working at all
a
Obviously you haven't understood what "changes size" in the doc means. It means the size of the content changes from its previous size. You are applying the size modifier at the beginning so the column's size won't change after it is laid out for the first time.
Have you checked the official example?
f
Well the column size changes
It just doesn’t animate
a
Then please post all the code. In the code you posted, the size of the column won't change.
f
Honestly I think you just confuse "size change" for "content change". It's not size change when you destroy one Column and create another one.
f
I got it working in one direction
I reworked the code - actually I wanted to have something different. I wanted to have the scale animated. This works now. Thanks for your help!