简体   繁体   中英

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). This is a picture of what I want to do. I tried to use Listview like this

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
),

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