我的目标是对齐下面的文本块,使其变得居中。当前对齐在左边。我尝试过使用textAlign.center,但这似乎不适用于RichText/TextSpan。任何帮助都非常感谢!
RichText(
text: TextSpan(
children: <TextSpan>[
const TextSpan(
text:
'Hello ',
),
TextSpan(
text: 'Click here',
style: const TextStyle(
color: Colors.blue, fontSize: 13),
recognizer: TapGestureRecognizer()
..onTap = () {
}),
const TextSpan(
text: ' this is a test',
),
],
),
),发布于 2022-11-05 03:16:20
用RichText包Center
Center(
child: RichText(
text: TextSpan(
children: <TextSpan>[
const TextSpan(text: 'Hello '),
TextSpan(
text: 'Click here',
style: const TextStyle(color: Colors.blue, fontSize: 13),
recognizer: TapGestureRecognizer()..onTap = () {},
),
const TextSpan(text: ' this is a test'),
],
),
),
),https://stackoverflow.com/questions/74324243
复制相似问题