[英]How to add an Icon left of text inside container
I have the following below widget:我有以下小部件:
Widget get _animatedButtonUI => Container(
height: 60,
width: 290,
decoration: BoxDecoration(
border: Border.all(
color: Color(0xFF9EC33B),
),
borderRadius: BorderRadius.circular(100.0),
color: Colors.white,
),
child: Center(
child: Text(
'COTINUE WITH GOOGLE',
style: TextStyle(
fontSize: 14.0,
fontWeight: FontWeight.bold,
color: Color(0xFF9EC33B),
),
),
),
);
as it was looks like the below figure:如下图所示:
Now I need to add Icon left of the Text
as the below image:现在我需要在Text
左侧添加图标,如下图所示:
So how can I do this....那么我该怎么做呢......
You just have to insert a Row inside the Container, just like this:你只需要在 Container 中插入一个 Row,就像这样:
Container(
height: 60,
width: 290,
decoration: BoxDecoration(
border: Border.all(
color: Color(0xFF9EC33B),
),
borderRadius: BorderRadius.circular(100.0),
color: Colors.white,
),
child: Row(
children: <Widget>[
Image.asset(yourImage),
Center(
child: Text(
'COTINUE WITH GOOGLE',
style: TextStyle(
fontSize: 14.0,
fontWeight: FontWeight.bold,
color: Color(0xFF9EC33B),
),
),
),
],
);
Edit: Make sure you fix that typo ("COTINUE WITH GOOGLE" => "CONTINUE WITH GOOGLE")编辑:确保你修正了那个错字(“COTINUE WITH GOOGLE”=>“CONTINUE WITH GOOGLE”)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.