简体   繁体   English

FLUTTER:如何为投票应用堆叠图像

[英]FLUTTER: How to stack images for voting app

I am doing a voting app and I have a problem, I want to stack images as many time there is votes(1 stack per vote).我正在做一个投票应用程序,我有一个问题,我想在有投票的时候堆叠图像(每票 1 个堆栈)。 This is a picture of what I want to do.这是我想要做的事情的图片。 I tried to use Listview like this我试过像这样使用 Listview

ListView(
  children: <Widget>[
    Image(
      image: AssetImage('assets/images/results/green.png'),
    ),
    Image(
      image: AssetImage('assets/images/results/green.png'),
    ),
  ],
),

The problem is that there is so much space between the 2 images.问题是两张图片之间的空间太大了。 Can you help me?你能帮助我吗?

在此处输入图像描述

Try to wrap the image with:尝试用以下方式包装图像:

Align(
  alignment: Alignment.topLeft,
  heightFactor: 0.94/*change this value until you are satisfied (between 0 and 1)*/,
  child: //your image
),

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

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