ayt*_*nch 4 dart flutter flutter-layout
我在这里查找了 pub.dev 和 flutter 文档,但找不到(或无法说出我的查询)任何针对此简单任务的解决方案。
我想显示一个String字母从上到下,同时保持字母方向默认。所以旋转Text()是行不通的。
我想要的结果是这样的:
H
E
L T
L H
O A
N
W K
O S
R ??
L
D
Run Code Online (Sandbox Code Playgroud)
另外,我需要将其换行String到下一行(在这种情况下为列)需要一个高度参数来限制每列从上到下的字母数。
如果这最后一部分太难实现,我愿意接受单列解决方案的想法。
截屏:
代码:
// Create a custom widget like this
class MyVerticalText extends StatelessWidget {
final String text;
const MyVerticalText(this.text);
@override
Widget build(BuildContext context) {
return Wrap(
runSpacing: 30,
direction: Axis.vertical,
alignment: WrapAlignment.center,
children: text.split("").map((string) => Text(string, style: TextStyle(fontSize: 22))).toList(),
);
}
}
Run Code Online (Sandbox Code Playgroud)
并像这样使用它:
MyVerticalText("HELLO WORLD THANKS??")
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1590 次 |
| 最近记录: |