Any idea why this logic isn't working?


The expected result is a square. But as you can see, it is n’t.

Any idea why this logic isn’t working ?

Note: The screen is a verticle arrangement. All three card views that you can see are placed within a horizontal arrangement & its height & width set to automatic.

because ur screen height is more than the screen width so card is not forming as ur expectation

if u want square then set the card view witdh and height equal in px

1 Like

Because all phones screen are in a rectangular shape.So in order to make it a square ,you should put the same value in its properties

Actually CardView’s left, right margin is more than top, bottom margin.
So you have to set Label inside it to square
And set CardView’s Height and Width to automatic.

I don’t understand what this logic has to do with Screen height ? The blocks only gets the screen width na ? Like if the screen width is 360 then the height and width of this card view is set to 0.16×screen.width.

But according to this logic the value given to both height and width (of the card view) is the same. If the screen width is 360 then the value 57.6 should be set to both height and width.

Are you talking about padding ? I tried it with and without padding.

Not padding.
Set the component inside the card to square.
Then the card will become square.

See, the black box is in square shape.
That means Card is in square shape.
But it is looking rectangle because of the margin.

IMG_20201205_110721

blocks (77)

changed the height & width of label inside to 56px X 56px. Still not working.

Set padding of card equal all sides.
And set Card’s height and width to automatic

Set height and width equal in pixels
You will see the square cardview

Then it wont be responsive. What I’m doing is the very same approach but in a different way. This method worked for all other pages (arrangements) expect this one. My question is straight & simple: “What’s wrong with this logic & why it’s not working ?”
It would be great if anyone could answers this. That way I can learn from my mistake & find a solution on my own.

It works this way, but look at the Do it results :roll_eyes:

Simple answer is ur phone is in the shape of rectangle and In rectangle the length is greater than its width so how can ur logic work?

He is using screen width * 0.16 for both height and width. So he’s logic is correct

1 Like

Did you really check my blocks ? Where did I use “Screen2.Height” ?? :roll_eyes:

Do this and tell the result

That makes sense, because the result of that operation will throw some decimals in it, and those will show in the math blocks. But the screen doesn’t have partial pixels, so it’s logical that there will be a rounding to the nearest integer when you get the value from the card.width block.

2 Likes

Ok… but why it is n’t working when the same value (0.16×Screen2.width) is given to both the width & height ? Cause it’s the same logic na ?