Dart 使容器在某一点透明
我有一个带有渐变的容器的登录应用程序,作为它的子容器,还有一个白色背景的容器。所以,我要做的是使一些按钮具有透明的背景,这样渐变背景就变得可见,就像按钮背景一样 我得到这个结果 我需要看起来像这样: (不考虑图标) 我的“按钮”代码是:Dart 使容器在某一点透明,dart,flutter,Dart,Flutter,我有一个带有渐变的容器的登录应用程序,作为它的子容器,还有一个白色背景的容器。所以,我要做的是使一些按钮具有透明的背景,这样渐变背景就变得可见,就像按钮背景一样 我得到这个结果 我需要看起来像这样: (不考虑图标) 我的“按钮”代码是: `Container( width: 32.0, height: 32.0, decoration: new BoxDecoration( shape: BoxShape.circle, color: Colors.tr
`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))
),`
有什么建议吗?您需要
类因此扩展了无状态小部件{
Color bg=Colors.white;//更改为图标后面的任何背景颜色
@凌驾
小部件构建(构建上下文){
返回脚手架(
appBar:appBar(),
正文:世界其他地区(
mainAxisAlignment:mainAxisAlignment.spaceAround,
儿童:[
文本(“使用登录”),
圆形(
子项:IconButton(图标:新图标(FontAwesomeIcons.facebookF,颜色:bg),ON按下:(){}),
背景颜色:常量颜色(0xffFF5486),
),
圆形(
子项:IconButton(图标:新图标(FontAwesomeIcons.twitter,颜色:bg),onPressed:(){}),
背景颜色:常量颜色(0xffFF5486),
),
],
),
);
}
}
您需要
类因此扩展了无状态小部件{
Color bg=Colors.white;//更改为图标后面的任何背景颜色
@凌驾
小部件构建(构建上下文){
返回脚手架(
appBar:appBar(),
正文:世界其他地区(
mainAxisAlignment:mainAxisAlignment.spaceAround,
儿童:[
文本(“使用登录”),
圆形(
子项:IconButton(图标:新图标(FontAwesomeIcons.facebookF,颜色:bg),ON按下:(){}),
背景颜色:常量颜色(0xffFF5486),
),
圆形(
子项:IconButton(图标:新图标(FontAwesomeIcons.twitter,颜色:bg),onPressed:(){}),
背景颜色:常量颜色(0xffFF5486),
),
],
),
);
}
}
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),
),
],
),
);
}
}