Flutter: Vertical Text widget

后端 未结 1 848
无人及你
无人及你 2021-01-14 17:09

I looked up here and pub.dev and flutter docs but could not find(or could not word my query) any solution for this simple task.

I want to display a String

相关标签:
1条回答
  • 2021-01-14 17:35

    Screenshot:


    Code:

    // 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(),
        );
      }
    }
    

    And use it like:

    MyVerticalText("HELLO WORLD THANKS❤️")
    
    0 讨论(0)
提交回复
热议问题