[英]Make a container transparent at certain point
I have a login application with a container with a gradient, and as a child of it, another container with a white background. 我有一个带有渐变的容器的登录应用程序,作为它的子项,另一个具有白色背景的容器。 So, what i'm trying to make some buttons with transparent background, so that the gradient background becomes visible, as the buttons background.
所以,我正在尝试制作一些透明背景的按钮,以便渐变背景变得可见,如按钮背景。
I get this result 我得到了这个结果
and I need to look like this: 我需要看起来像这样:
(Dont take into account the icons) (不要考虑图标)
My "button" code is: 我的“按钮”代码是:
`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))
),`
Any suggestion? 有什么建议吗?
You will need Font Awesome Icon pack for Flutter 你需要Flutter的Font Awesome Icon包
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),
),
],
),
);
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.