Luk*_*tti 5 flutter flutter-layout
可以在Flutter中将文本换成一个圆形吗?这是一个失败的例子。理想情况下,文本将适合圆圈,并且仅在末尾溢出。
ClipOval(
child: SizedBox.expand(
child: Text(
"Round and round the rugged rocks, the rascally rascals ran. Round and round the rugged rocks, the rascally rascals ran. Round and round the rugged rocks, the rascally rascals ran. Round and round the rugged rocks, the rascally rascals ran. ",
softWrap: true,
overflow: TextOverflow.fade,
),
),
),
Run Code Online (Sandbox Code Playgroud)
截至目前(2019 年 7 月),Flutter 不直接支持以非矩形形状布置文本。
使用现有的 API,应该可以通过实现以下步骤来实现类似的自定义效果:
那应该能让你接近一些东西。该实现将必须处理每个 y 位置的圆宽度的所有计算以及手动定位每行文本。
| 归档时间: |
|
| 查看次数: |
156 次 |
| 最近记录: |