使容器在某一点透明

问题描述 投票:0回答:1

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

我得到了这个结果

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个回答
0
投票

你需要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),
          ),
        ],
      ),
    );
  }
}
© www.soinside.com 2019 - 2024. All rights reserved.