简体   繁体   中英

In Flutter, how can we stack and position the images randomly?

Below is the image that I like to build but kinda not sure where to start with, is there a plugin that I missed while searching?

I should be able to stack images which should be reasonably visible though they are stacked on each other and randomly positioned - one below the other or one beside the other images depending on available space and scroll them horizontally.

If it's like a lot of code then please guide me in right direction. Thanks.

在此处输入图像描述

You'll most likely want to use Stack, Positioned and Transform.rotate.

eg

Stack(
  children: [
    Positioned(
      left: getRandomX(),
      bottom: getRandomY(),
      child: Transform.rotate(
         angle: getRandomAngle()
         child: Image.memory(...)
      )
    )
  ]
)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM