简体   繁体   English

Flutter 使容器透明

[英]Flutter make container transparent

   Material(
      elevation: 30.0,
      shadowColor: Colors.grey,
      child: Container(            
        width: 300,
        child: SingleChildScrollView(
          child: TextField(
            controller: controller,
            style: TextStyle(
              color: Colors.black,
              fontSize: 30,
            ),
            decoration: InputDecoration(
              border: OutlineInputBorder(),
              hintText: 'hinttText',
              focusedBorder: OutlineInputBorder(
                borderRadius: BorderRadius.circular(10.0),
                borderSide: BorderSide(
                  color: Colors.black,
                  width: 2.0,
                ),
              ),

), ),

...................................... .....................................

...................................... .....................................................

...................................... .....................................................

How do I make my flutter container color to transparent.(only the container. Not Text Field)如何使我的 flutter 容器颜色透明。(仅容器。不是文本字段)

Use Colors.transparent this sets it to transparent使用Colors.transparent将其设置为透明

Material(
      elevation: 30.0,
      shadowColor: Colors.grey,
      child: Container(            
        width: 300,
        color: Colors.transparent,         //<------ this line
        child: SingleChildScrollView(
          child: TextField(
            controller: controller,
            style: TextStyle(
              color: Colors.black,
              fontSize: 30,
            ),
            decoration: InputDecoration(
              border: OutlineInputBorder(),
              hintText: 'hinttText',
              focusedBorder: OutlineInputBorder(
                borderRadius: BorderRadius.circular(10.0),
                borderSide: BorderSide(
                  color: Colors.black,
                  width: 2.0,
                ),
              ),
            )
          )
        )
      )
    )

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM