我正在尝试创建一个简单的手势检测器,其中包含一些文本和一个图标在开始位置,但是当我尝试将图标居中时似乎遇到了难题(是的,我已经尝试过一行,但我需要宽度不超过内容范围的解决方案),以下是我目前所拥有的:
Container(
color: Colors.white,
child: GestureDetector(
onTap: () => setState(() {
playerNames.remove(name);
}),
child: RichText(
text: TextSpan(children: [
WidgetSpan(
child: Icon(
Icons.clear,
size: MediaQuery.of(context).size.height * 0.02,
),
),
WidgetSpan(
child: AutoSizeText(
name,
maxLines: 1,
style: new TextStyle(
fontSize:
MediaQuery.of(context).size.height * 0.021,
color: Color.fromRGBO(0, 0, 0, 0.71)),
),
)
]),
)),
)