Home > Blockchain >  Flutter image in stack contain
Flutter image in stack contain

Time:07-11

I put an Image in a Stack because I want to have a x-Button in the upper right corner. But I don't know, how to set the image like this. enter image description here

It actual looks like this: enter image description here

This is the code:

list.add(Column(
          crossAxisAlignment: CrossAxisAlignment.center,
          children: <Widget>[
            Container(
              child: Stack(children: [
                Flexible(
                    child:
                        Image.network("${globals.api}/download/$nextPicture")),
                Align(
                  alignment: const Alignment(0.95, -0.95),
                  child: IconButton(
                    icon:
                        const Icon(Icons.cancel, color: Colors.white, size: 25),
                    onPressed: () {
                      deleteSelectedImageRemote(nextPicture);
                    },
                  ),
                )
              ]),
            )
          ]));

Do you have any suggestions, how to make it look like the Details page?

Thank you very much!

CodePudding user response:

try this

list.add(Column(
      crossAxisAlignment: CrossAxisAlignment.center,
      children: <Widget>[
        Container(
          child: Stack(children: [
            Container(
                width:200,
                height:200,
                child:
                    Image.network("${globals.api}/download/$nextPicture")),
            Align(
              alignment: const Alignment(0.95, -0.95),
              child: IconButton(
                icon:
                    const Icon(Icons.cancel, color: Colors.white, size: 25),
                onPressed: () {
                  deleteSelectedImageRemote(nextPicture);
                },
              ),
            )
          ]),
        )
      ]));
  • Related