【发布时间】:2020-01-29 22:31:53
【问题描述】:
我正在尝试创建一个表格,其中文本自动缩放以适合单元格,但所有单元格将具有相同的文本大小,同时最大化字体大小。我试过 FittedBox 但它不会那样工作。任何想法如何进行?
class MyTable extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
child: Column(
children: [
Expanded(
child: Row(
children: [
Expanded(child: Center(child: Text("R1C1: Some text1"))),
Expanded(child: Center(child: Text("R1C2: Some text2"))),
Expanded(child: Center(child: Text("R1C3: Some text3"))),
],
),
),
Expanded(
child: Row(
children: [
Expanded(child: Center(child: Text("R2C1: Some text4"))),
Expanded(child: Center(child: Text("R2C2: Some text5"))),
Expanded(child: Center(child: Text("R2C3: Some text6"))),
],
),
),
Expanded(
child: Row(
children: [
Expanded(child: Center(child: Text("R3C1: Some text7"))),
Expanded(child: Center(child: Text("R3C2: Some text8"))),
Expanded(child: Center(child: Text("R3C3: Some text9"))),
],
),
),
],
),
);
}
}
【问题讨论】: