Add Picture frame/size #59

Open
opened 2025-04-18 02:57:40 +02:00 by jj11 · 5 comments

Currently I'm not able to control the size of an image

Describe the solution you'd like

  1. I would like to see a way to control the size and frame of any image

Describe alternatives you've considered

  • None

Additional context

  • If you look in this video, I don't know why the image size changes when searched for specific item
### Is your feature request related to a problem? Please describe. Currently I'm not able to control the size of an image ### Describe the solution you'd like 1. I would like to see a way to control the size and frame of any image ### Describe alternatives you've considered - None ### Additional context - If you look in this video, I don't know why the image size changes when searched for specific item
jj11 added the
enhancement
label 2025-04-18 02:57:40 +02:00
Author

Plus there's padding issues, even after to HStack there wasn't space so I don't know what the reason

Plus there's padding issues, even after to HStack there wasn't space so I don't know what the reason
Owner

I would like to see a way to control the size and frame of any image

You can set a picture's frame using frame(maxWidth:) and/or frame(maxHeight:).

Plus there's padding issues, even after to HStack there wasn't space so I don't know what the reason

I'd love to help, but I don't fully understand the description of the problem - could you maybe add some details?

> I would like to see a way to control the size and frame of any image You can set a picture's frame using [`frame(maxWidth:)`](https://adwaita-swift.aparoksha.dev/documentation/adwaita/anyview/frame(maxwidth:)/) and/or [`frame(maxHeight:)`](https://adwaita-swift.aparoksha.dev/documentation/adwaita/anyview/frame(maxheight:)/). > Plus there's padding issues, even after to HStack there wasn't space so I don't know what the reason I'd love to help, but I don't fully understand the description of the problem - could you maybe add some details?
Author
image.png image.png image.png

I have added padding to HStack however padding is not there as much I don't know why? Like frame did work but it's like hit or miss when we search for "Dolphin" you could see the difference in what I mean

<img width="2401" alt="image.png" src="attachments/f058af21-2bb1-4858-82c9-ac63cd456cc2"> <img width="1002" alt="image.png" src="attachments/7373ce40-06f4-4c0b-938f-9c115da6098f"> <img width="1002" alt="image.png" src="attachments/84ddf93e-4219-4136-944a-1d0ba2a2b4ea"> I have added padding to HStack however padding is not there as much I don't know why? Like frame did work but it's like hit or miss when we search for "Dolphin" you could see the difference in what I mean
Author

Or may be I don't understand how List works here then because it has only one item but I was thinking ListItems would be given the same space in terms of height.

Or may be I don't understand how List works here then because it has only one item but I was thinking ListItems would be given the same space in terms of height.
Owner

Is it the padding? I think it's still the image that is changing its size. You should be able to fix this by modifying with frame(minWidth:minHeight:) to the same values (32/32) so that the icon cannot get smaller than the maximum width/height.

Picture()
    .data(data)
    .frame(minWidth: 32, minHeight: 32)
    .frame(maxWidth: 32)
    .frame(maxHeight: 32)

Does this help?

Is it the padding? I think it's still the image that is changing its size. You should be able to fix this by modifying with [`frame(minWidth:minHeight:)`](https://adwaita-swift.aparoksha.dev/documentation/adwaita/anyview/frame(minwidth:minheight:)/) to the same values (32/32) so that the icon cannot get smaller than the maximum width/height. ```swift Picture() .data(data) .frame(minWidth: 32, minHeight: 32) .frame(maxWidth: 32) .frame(maxHeight: 32) ``` Does this help?
Sign in to join this conversation.
No Milestone
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: aparoksha/adwaita-swift#59
No description provided.