如何实现垂直方向的文字?

时间:2019-04-28 09:53:30

标签: flutter

我想使用TextDirection从上到下实现文本,但是TextDirection只有两个选项。

enum TextDirection {
  /// The text flows from right to left (e.g. Arabic, Hebrew).
  rtl,

  /// The text flows from left to right (e.g., English, French).
  ltr,
}

2 个答案:

答案 0 :(得分:1)

这两种方法都可以使用

Center(
        child: Column(mainAxisSize: MainAxisSize.min, children: [
          RotatedBox(
            child: Text("rotated"),
            quarterTurns: 3,
          ),
          Divider(),
          Column(
            children: "stacked".split('').map((c) => Text(c)).toList(),
          )
        ]),
      )

一个正在旋转文本。另一种是在列中堆叠字符。

答案 1 :(得分:0)

您可以使用RotatedBox

RotatedBox(
    quarterTurns: 1, 
    child: Text("Hello")
),
相关问题