How to dynamically resize text in Flutter?

后端 未结 7 1681
梦如初夏
梦如初夏 2021-01-31 06:53

I retrieve a piece of text from an API. I want to allot a set amount of space to it (say a max Container with width: 300.0 and height: 100.0). Sometimes, the piece of text fits

7条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-31 07:33

    Here is a list of things I tried which may work for you depending on your use case: https://github.com/flutter/flutter/issues/18431

    Ultimately I went with a function that sets the font size based on the length of the String (i.e. with if-else statements).

提交回复
热议问题