title: Flutter how to set container background as transparent color
body: <p><a href="https://stackoverflow.com/questions/51837717/make-container-background-as-transparent">I found this question but doesn't work for me.</a></p>
  
  <p>I also play with <code>Opacity</code> widget and <em>decoration</em> color of <code>Container</code>. But didn't find solution It always display <strong>white</strong> background color when I set it transparent.</p>
  
  <p>Look at below image, Instead of red color it should be transparent.</p>
  
  <p><a href="https://i.stack.imgur.com/yg7IK.png" rel="noreferrer"><img src="https://i.stack.imgur.com/yg7IK.png" alt="enter image description here"></a></p>
  
  <p>Below are my code:</p>
  
  <pre><code>_showAlertDialog(String strTitle, String strDetails) {
      showDialog(
          context: context,
          builder: (BuildContext context) {
            return AlertDialog(
              contentPadding: EdgeInsets.zero,
              content: Stack(
                children: &lt;Widget&gt;[
                  Opacity(
                    opacity: 1, // Also tried to set 0
                    child: Container(
                      padding: EdgeInsets.all(8.0),
                      decoration: BoxDecoration(
                        color: Color.fromRGBO(255, 0, 0, 0.5) // I played with different colors code for get transparency of color but Alway display White. 
                      ),
                      child: Column(
                        mainAxisSize: MainAxisSize.min,
                        children: &lt;Widget&gt;[
                          Container(
                            height: 50,
                            padding: EdgeInsets.only(left: 10, right: 10, top: 2),
                            color: Theme.of(context).primaryColor,
                            child: Center(
                              child: Text(
                                strTitle,
                                style: TextStyle(
                                    color: Colors.white,
                                    fontWeight: FontWeight.w500,
                                    fontSize: 14),
                                maxLines: 2,
                              ),
                            ),
                          ),
                          Flexible(
                            child: Container(
                              color: Colors.white,
                              padding: EdgeInsets.all(10),
                              child: SingleChildScrollView(
                                child: Text(
                                  strDetails,
                                  style: TextStyle(color: Colors.black87, fontSize: 12, fontWeight: FontWeight.w400),
                                ),
                              ),
                            ),
                          ),
                        ],
                      ),
                    ),
                  ),
                  Positioned(
                      top: 0,
                      right: 0,
                      child:
                      Container(
                        height: 24,
                        width: 24,
                        child: DecoratedBox(
                          child: IconButton(
                              padding: EdgeInsets.zero,
                              icon: Icon(Icons.close, color: Theme.of(context).primaryColor, size: 18,), onPressed: () {
                            Navigator.of(context).pop();
                          }),
                          decoration: BoxDecoration(
                              color: Colors.white,
                              borderRadius: BorderRadius.circular(12)
                          ),
                        ),
                      )
                  )
                ],
              ),
            );
          });
    }
  }
  </code></pre>