Hard code you heights on both to the size you want when they both show. Set a variable for toggling visibility of Form1 with OnVisable of the Screen to have UpdateContext({varForm1Visable:true}) and put that varForm1Visable in Visable property of top Form1.
If your height of form2 is 500 then something like this for Height on Form2.
Then take the height of the bottom form and do like : If( Form1.Visable, 500, 500 + (Form2.Y - Form1.Y))
That will take the Form2 and use the top location Y and grow it based on the distance from Form2.Y.
Then for the show / hide of Form1 you could just have one button/icon etc. that does UpdateContext({varForm1Visable: !varForm1Visable}) this will toggle it on / off and resize Form2 when toggled.