简体   繁体   English

在 Flutter 中,我们如何随机堆叠和 position 图像?

[英]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.您很可能希望使用 Stack、Positioned 和 Transform.rotate。

eg例如

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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