我有一个表,其中填充了更改了的行数和列数。
我想将每张卡中的文本大小更改为最大可能的大小,以便单词仍然能够舒适地阅读。
卡内的单词每次都会更改。
谢谢。
class GameCardButton extends StatelessWidget { final String word; final Color cardColor;
GameCardButton({@required this.word, this.cardColor});
@override Widget build(BuildContext context) {
return Expanded(
child: MaterialButton(
//TODO: implement onPressed
onPressed: () {},
color: Colors.white,
shape: RoundedRectangleBorder(
side: BorderSide(color: Colors.teal),
),
child: Text(
word,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 15.0,
),
),
),
); } }
最佳答案
这样包装Text
小部件:
Row(
children: [
Expanded(
child: FittedBox(
child: Text(
word,
textAlign: TextAlign.center,
),
),
),
],
)
关于android - 如何动态更改卡内的文本大小?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63904024/