这是我的代码
RichText(
text: TextSpan(children: [
TextSpan(
text: 'flutterABC',
style: TextStyle(
fontSize: isDesktop(context) ? 64 : 32,
fontWeight: FontWeight.w800)),
TextSpan(
text: 'flutterABC',
style: TextStyle(
fontSize: isDesktop(context) ? 64 : 32,
fontWeight: FontWeight.w800,
color: Colors.indigo))
]),
),就像这样。我使用RichText和TextSpan。当我在chrome中运行时,我不能控制align,如果'flutterABCflutterABC‘是一行> align是居中。但是如果两行> align是开始..
我想总是居中对齐,我该怎么办?


发布于 2021-10-04 06:19:42
请试一下这个。
RichText(
text: TextSpan(
children:[
TextSpan(
text: 'flutterABC\n',
style: TextStyle(
fontWeight: FontWeight.w800)),
TextSpan(
text: 'flutterABC',
style: TextStyle(
fontWeight: FontWeight.w800,
color: Colors.indigo))
]),
),https://stackoverflow.com/questions/69430782
复制相似问题