It's a bit hard to word in the title but here's my situation. I have a VStack and I need to animate a gap forming below a tapped item in the stack.
I've tried adding .padding(.bottom, isTapped ? 50 : 0) to the items for example, but it doesn't produce the desired result. For example if item X is the item i've tapped this is the behaviour that I get with this method
empty space --> X-1
X-1 --> X
X --> space created
X+1 --> X+1
empty space --> empty space
basically, as I tried to illustrate, it pushes the items above X upwards as well as pushing the items below it downward.
Is there any way to go about doing what I'm trying to do? A way to fix X and the items above it in place so that only the items below will shift?
edit: Here's a more real example, when the middle item is tapped, it causes padding to be added below it, but unfortunately that doesn't just leave the first 2 where they are and push the third one down. But it moves the first 2 up and the third down. (Also the padding doesn't lay as shown in the example below, but within the Item View itself if that makes a difference)
VStack{
Item().padding(.bottom, isTapped ? 50: 0)
Item().padding(.bottom, isTapped ? 50: 0)
Item().padding(.bottom, isTapped ? 50: 0)
}