How to decorate text stroke in Flutter?

前端 未结 5 938
孤独总比滥情好
孤独总比滥情好 2020-12-17 09:14

How to decorate text stroke in Flutter? It\'s like -webkit-text-stroke - CSS

5条回答
  •  佛祖请我去吃肉
    2020-12-17 09:40

    I was also looking for this, wasn't able to find it. But I did find a workaround using 4 shadows in the TextStyle:

    Text("Border test",
        style: TextStyle(
          inherit: true,
          fontSize: 48.0,
          color: Colors.pink,
          shadows: [
            Shadow( // bottomLeft
              offset: Offset(-1.5, -1.5),
              color: Colors.white
            ),
            Shadow( // bottomRight
              offset: Offset(1.5, -1.5),
              color: Colors.white
            ),
            Shadow( // topRight
              offset: Offset(1.5, 1.5),
              color: Colors.white
            ),
            Shadow( // topLeft
              offset: Offset(-1.5, 1.5),
              color: Colors.white
            ),
          ]
        ),
    );
    

    I also opened an Issue on GitHub: https://github.com/flutter/flutter/issues/24108

提交回复
热议问题