我心愛的??沒有出現。不過,它曾經在 Flutter 3.0.0 中使用過。
現在,使用 Flutter 3.3.6 Dart SDK 2.18.2,它沒有。
有誰知道這是否是一個錯誤?或者有人知道自動縮放的解決方法嗎?
最小的例子:
class OtterFreakshow extends StatelessWidget {
@override
Widget build(BuildContext context) {
return
Column(children: [
// works as expected with single letters
Container(
color: Colors.green,
width:200, height: 200 ,child: const FittedBox(child: Text('A'))),
// works as expected for emoji with surrounding letters
Container(color: Colors.purple,
width:200, height: 200 ,child: const FittedBox(child: Text('_??_'))),
// not rendering correctly (invisible!) without some letters surrounding the otter
Container(color: Colors.red,
width:200, height: 200 ,child: const FittedBox(child: Text('??')))
]);
}}
產量:

如果你對此感到不安全,
使用auto_size_text插件
如果您想根據父視窗小部件的寬度和高度自動調整字體大小,使用auto_size_textpackage 是最好的選擇。它真的很容易使用并且有豐富的檔案。
樣品用法:
AutoSizeText(
'The text to display',
style: TextStyle(fontSize: 20),
maxLines: 2,
)
玩得開心!
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/524826.html
標籤:扑镖使成为表情符号缩放
