【问题标题】:Make a container transparent at certain point使容器在某个点透明
【发布时间】:2019-04-30 11:22:17
【问题描述】:

我有一个带有渐变容器的登录应用程序,作为它的子容器,还有另一个白色背景的容器。所以,我正在尝试制作一些具有透明背景的按钮,以便渐变背景变得可见,作为按钮背景。

我得到了这个结果

My work

我需要看起来像这样:

What I need

(不要考虑图标)

我的“按钮”代码是:

`Container(
   width: 32.0,
   height: 32.0,
   decoration: new BoxDecoration(
     shape: BoxShape.circle,
     color: Colors.transparent
   ),
   child: Center(child: Text("G", style: TextStyle(fontSize: 20, color: 
   Colors.black), textAlign: TextAlign.center))
),`

有什么建议吗?

【问题讨论】:

    标签: dart flutter


    【解决方案1】:

    你需要Font Awesome Icon pack for Flutter

    class SO extends StatelessWidget {
      Color bg = Colors.white;// change to whatever background color is behind icons
    
      @override
      Widget build(BuildContext context) {
        return Scaffold(
          appBar: AppBar(),
          body: Row(
            mainAxisAlignment: MainAxisAlignment.spaceAround,
            children: <Widget>[
              Text("sign in with"),
              CircleAvatar(
                child: IconButton(icon: new Icon(FontAwesomeIcons.facebookF, color: bg), onPressed: () {}),
                backgroundColor: const Color(0xffFF5486),
              ),
              CircleAvatar(
                child: IconButton(icon: new Icon(FontAwesomeIcons.twitter, color: bg), onPressed: () {}),
                backgroundColor: const Color(0xffFF5486),
              ),
            ],
          ),
        );
      }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-02-15
      • 1970-01-01
      • 1970-01-01
      • 2012-07-27
      • 2012-01-01
      • 1970-01-01
      相关资源
      最近更新 更多