Flutter 颤振-字体超棒图标溢出文本
我正在我的应用程序中使用 FontAwesomeIcon插件中的一些图标与文本小部件重叠,如下图所示 我可以通过在文本和图标之间增加一些宽度来解决这个问题,但这并不好。那么如何解决这个问题呢 我需要像这样的图像 这里我没有在图标和文本之间添加任何宽度 代码:Flutter 颤振-字体超棒图标溢出文本,flutter,dart,icons,font-awesome,font-awesome-5,Flutter,Dart,Icons,Font Awesome,Font Awesome 5,我正在我的应用程序中使用 FontAwesomeIcon插件中的一些图标与文本小部件重叠,如下图所示 我可以通过在文本和图标之间增加一些宽度来解决这个问题,但这并不好。那么如何解决这个问题呢 我需要像这样的图像 这里我没有在图标和文本之间添加任何宽度 代码: 行( mainAxisAlignment:mainAxisAlignment.spaceBetween, 儿童:[ 划船( 儿童:[ 图标( Icons.trip_原点, 颜色:颜色,白色, ), 正文( ‘TP-23’, 样式:Tex
行(
mainAxisAlignment:mainAxisAlignment.spaceBetween,
儿童:[
划船(
儿童:[
图标(
Icons.trip_原点,
颜色:颜色,白色,
),
正文(
‘TP-23’,
样式:TextStyle(颜色:Colors.white),
)
],
),
划船(
儿童:[
图标(
FontAwesomeIcons.idCard,
颜色:颜色,白色,
),
正文(
‘TP-23’,
样式:TextStyle(颜色:Colors.white),
)
],
)
],
),
你看起来像这样吗
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Row(
children: <Widget>[
Icon(
Icons.trip_origin,
color: Colors.white,
),
SizeBox(width:10) //as per your requirement
Text(
'TP-23',
style: TextStyle(color: Colors.white),
)
],
),
Row(
children: <Widget>[
Icon(
FontAwesomeIcons.idCard,
color: Colors.white,
),
SizeBox(width:10) //as per your requirement
Text(
'TP-23',
style: TextStyle(color: Colors.white),
)
],
)
],
),
行(
mainAxisAlignment:mainAxisAlignment.spaceBetween,
儿童:[
划船(
儿童:[
图标(
Icons.trip_原点,
颜色:颜色,白色,
),
尺寸盒(宽度:10)//根据您的要求
正文(
‘TP-23’,
样式:TextStyle(颜色:Colors.white),
)
],
),
划船(
儿童:[
图标(
FontAwesomeIcons.idCard,
颜色:颜色,白色,
),
尺寸盒(宽度:10)//根据您的要求
正文(
‘TP-23’,
样式:TextStyle(颜色:Colors.white),
)
],
)
],
),
你看起来像这样吗
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Row(
children: <Widget>[
Icon(
Icons.trip_origin,
color: Colors.white,
),
SizeBox(width:10) //as per your requirement
Text(
'TP-23',
style: TextStyle(color: Colors.white),
)
],
),
Row(
children: <Widget>[
Icon(
FontAwesomeIcons.idCard,
color: Colors.white,
),
SizeBox(width:10) //as per your requirement
Text(
'TP-23',
style: TextStyle(color: Colors.white),
)
],
)
],
),
行(
mainAxisAlignment:mainAxisAlignment.spaceBetween,
儿童:[
划船(
儿童:[
图标(
Icons.trip_原点,
颜色:颜色,白色,
),
尺寸盒(宽度:10)//根据您的要求
正文(
‘TP-23’,
样式:TextStyle(颜色:Colors.white),
)
],
),
划船(
儿童:[
图标(
FontAwesomeIcons.idCard,
颜色:颜色,白色,
),
尺寸盒(宽度:10)//根据您的要求
正文(
‘TP-23’,
样式:TextStyle(颜色:Colors.white),
)
],
)
],
),
为什么不像这样使用Padding小部件()
在图标小部件的左侧和右侧添加填充
行(
儿童:[
填充物(
填充:边集。对称(水平:16.0)
子:图标(
Icons.trip_原点,
颜色:颜色,白色,
),
),
正文(
‘TP-23’,
样式:TextStyle(颜色:Colors.white),
)
]
)
仅在图标小部件的右侧添加填充
行(
儿童:[
填充物(
填充:仅限边集(右:16.0)
子:图标(
Icons.trip_原点,
颜色:颜色,白色,
),
),
正文(
‘TP-23’,
样式:TextStyle(颜色:Colors.white),
)
]
)
为什么不像这样使用Padding小部件()
在图标小部件的左侧和右侧添加填充
行(
儿童:[
填充物(
填充:边集。对称(水平:16.0)
子:图标(
Icons.trip_原点,
颜色:颜色,白色,
),
),
正文(
‘TP-23’,
样式:TextStyle(颜色:Colors.white),
)
]
)
仅在图标小部件的右侧添加填充
行(
儿童:[
填充物(
填充:仅限边集(右:16.0)
子:图标(
Icons.trip_原点,
颜色:颜色,白色,
),
),
正文(
‘TP-23’,
样式:TextStyle(颜色:Colors.white),
)
]
)
子项:容器(
子:容器(
高度:500.0,
宽度:500.0,
//对齐:分馏loffset.center,
子:堆栈(
//对齐:新对齐(x,y)
儿童:[
图标(
Icons.trip_原点,
尺寸:40.0,
颜色:颜色。橙色,
),
定位(
顶部:15.00,
左:40.0,
子:文本(
‘TP-23’,
样式:TextStyle(
颜色:颜色。白色,字体大小:25.0),
),
)
],
),
),
),
子项:容器(
子:容器(
高度:500.0,
宽度:500.0,
//对齐:分馏loffset.center,
子:堆栈(
child: Container(
child: Container(
height: 500.0,
width: 500.0,
// alignment: FractionalOffset.center,
child: Stack(
//alignment:new Alignment(x, y)
children: <Widget>[
Icon(
Icons.trip_origin,
size: 40.0,
color: Colors.orange,
),
Positioned(
top: 15.00,
left: 40.0,
child: Text(
'TP-23',
style: TextStyle(
color: Colors.white, fontSize: 25.0),
),
)
],
),
),
),