outOrNoWith static method
判断字符串是否多余lineNum
Implementation
static bool outOrNoWith(String text, double width, int lineNum, double fontSize){
var span = TextSpan(
text: text,
style: TextStyle(fontSize: fontSize),
);
var tp = TextPainter(
maxLines: lineNum,
textAlign: TextAlign.left,
textDirection: TextDirection.ltr,
text: span,
);
tp.layout(maxWidth: width);
// whether the text overflowed or not
return tp.didExceedMaxLines;
}