1

I want to create a blank image with a white background and a specified size in Flutter, then I may add other images onto this blank image later to merge them as a new image. I am working on my first Flutter project and still learning new things by doing this project. Thanks for any hint.

Update: The blank image here means an Image with only white color in it.

enter image description here

echo
  • 1,244
  • 1
  • 16
  • 40
  • Create a container and set size for it, then use decoration to set background with image. – Hesam Rasoulian Feb 15 '20 at 17:27
  • what do you mean by "a blank image"? this [Image](https://api.flutter.dev/flutter/widgets/Image-class.html) or this [Image](https://api.flutter.dev/flutter/dart-ui/Image-class.html) or something else? – pskink Feb 15 '20 at 17:35
  • It is an Image object with only white color. – echo Feb 15 '20 at 17:56

2 Answers2

4

What about?

Uint8List blankBytes = Base64Codec().decode("R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7");    
Image.memory(blankBytes,height: 1,);
gotnull
  • 26,454
  • 22
  • 137
  • 203
0

For your "blank image", you can use a widget Card.

For the size of it, you can try using the widget AspectRatio. It allows you to set its size relative to the parent size with proportions.

If you want a specified size no matter what's the size of your screen, I can't really help you.

You can refer to the answer of this question too: Changing Aspect Ratio of Image in Flutter Even if it's not for a real image, the widget disposition in this example can help you I think.

For any doupt and for your personnal knowledge, here is the Flutter widget catalog site.

Bench
  • 1
  • 1