How can I resize the image widgets while maintaing the aspect ratio of all the widgets inside a row?

136

Wrap widget is what you need with of course little customization as well.

What is it do does is basically wrap all the widgets in a single row with spaces that you want with width dynamically. Give it shot!

  • Here's the official doc.
  • Here's a medium article explaining it well.
Share:
136
Shourya Shikhar
Author by

Shourya Shikhar

Currently in love with:Flutter, Data Structures and Open Source Always have been in love with:Music

Updated on January 04, 2023

Comments

  • Shourya Shikhar
    Shourya Shikhar over 1 year

    I wanted to design this UI using Row: enter image description here

    I have a similar scenario where I don't know the size and orientation of the images. This is what I can think of: Put all the image widgets and wrap it within a row. But since I don't know the size as well as the orientation of the images, the widgets will not be properly placed as in the above image.

    I've tried resizing the images by using scale factor. But since the size varies, the images are never uniformly scaled. Also whenever the orientation is different for a particular image, the UI ca not scale itself accordingly.

    I would like to get an idea on how can this type of UI can be created in Flutter?

    Note: I don't own the copyrights of the image. Using this screenshot for only educational purpose from here.

    • Zac
      Zac over 2 years
      Have you tried using the AspectRatio widget along with the IntrinsicHeight/Width widgets?