How to put opacity for container in flutter

Change the line

const Color(0xFF0E3311)

to

const Color(0xFF0E3311).withOpacity(0.5)

or any value you want.


If you just want to set an opacity to your color it's simple as adding 2 hex numbers before your color code. Check this answer to know all the values.

But if you want to change the opacity of all the widget, in your case a Container, you can wrap it into a Opacity widget like this:

double _opacityValue = 0.50;//This value goes from 0.0 to 1.0. In this case the opacity is from 50%

final Widget _bodyWithOpacity = Opacity(
  opacity: _opacityValue,
  child: body,
);

Check here the Opacity's documentation and this quick video if you want to know more about it!