'Add tag/label on top of images flutter with relative position
I am building an Instagram clone (specifically image tag feature). I am able to put tags on top of images the user uploads but when the screen size/orientation/Zoom changes the tags does not reposition themselves.
Could anyone tell me how can I achieve this and store tag position so that when I load image again in user feed, I could be able to see tags on the image.
Solution 1:[1]
You can wrap the image and the label in a Column or a Stack. A Column will put both the tag and the image in the center while with a Stack you can align the image in the center and the text below.
Example with Column: Column (children: [Image.asset('assets/myasset.png'), Text('My image'), ] ),
Example with a Stack: Stack(children:[Center(child: Text('My Image')), Align(alignment:Alignment.bottomCenter,child: Image.asset('assets/myasset.png'))]),
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Miroslav Blagoev |