透明背景的颤振卡

时间:2019-04-12 06:04:59

标签: colors flutter

我试图使我的卡透明,以便在后台显示事物。

我曾尝试将卡的颜色属性设置为透明,但是显示的是灰色背景且不透明。

Result

我也尝试使用不透明度不同的白色,但是结果不是透明的纯白色。

   Card(
      color: Colors.transparent,
      child: Padding(
        padding: const EdgeInsets.all(16),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.stretch,
          children: <Widget>[
            CardLabelSmall("Current Premix Plan Document"),
            Expanded(child: PremixPlanDocList()),
            Row(
              children: <Widget>[
                Expanded(
                  child: RaisedButton(
                    onPressed: () async {
                      homeBloc.retrieveCurrentMrfPremixPlan();
                    },
                    child: const Text("Retrieve Premix Plan"),
                  ),
                ),
              ],
            ),
          ],
        ),
      ),
    );

其他白色,但仍然不是白色

color: Colors.white70,
color: Colors.white54,
color: Colors.white30,

如何获得具有透明色的纯白色背景?

2 个答案:

答案 0 :(得分:0)

尝试将elevation设置为0,它应该可以工作

Card(
      elevation: 0,
      color: Colors.transparent,
      child: Padding(
        padding: const EdgeInsets.all(16),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.stretch,
          children: <Widget>[
            CardLabelSmall("Current Premix Plan Document"),
            Expanded(child: PremixPlanDocList()),
            Row(
              children: <Widget>[
                Expanded(
                  child: RaisedButton(
                    onPressed: () async {
                      homeBloc.retrieveCurrentMrfPremixPlan();
                    },
                    child: const Text("Retrieve Premix Plan"),
                  ),
                ),
              ],
            ),
          ],
        ),
      ),
    );

答案 1 :(得分:0)

您可以尝试这样的事情。

  new Container(
                height: 300.0,
                color: Colors.blue,
                child: new Card(
                    color: Colors.transparent,
                    child: new Center(
                      child: new Text("Hi modal sheet"),
                    )),
              ),

enter image description here