Flutter 颤振中栅格内的自动缩放文本

Flutter 颤振中栅格内的自动缩放文本,flutter,flutter-layout,Flutter,Flutter Layout,我试图在flutter中创建一个表格,其中文本自动缩放以适应单元格,但所有单元格都将具有相同的文本大小,同时最大化字体大小。我试过FittedBox,但它不能那样工作。有什么办法吗 class MyTable extends StatelessWidget { @override Widget build(BuildContext context) { return Container( child: Column( children: [

我试图在flutter中创建一个表格,其中文本自动缩放以适应单元格,但所有单元格都将具有相同的文本大小,同时最大化字体大小。我试过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"))),
              ],
            ),
          ),
        ],
      ),
    );
  }
}


我能用软件包解决这个问题。我使用组来同步所有单元格的大小

class MyTable extends StatelessWidget {
  final AutoSizeGroup myGroup = AutoSizeGroup();

  @override
  Widget build(BuildContext context) {
    return Container(
      child: Column(
        children: [
          Expanded(
            child: Row(
              children: [
                Expanded(
                  child: Center(
                    child: AutoSizeText(
                      "R1C1: Some text1",
                      style: TextStyle(fontSize: 50),
                      group: myGroup,
                    ),
                  ),
                ),
                Expanded(
                  child: Center(
                    child: AutoSizeText(
                      "R1C2: Some text2",
                      style: TextStyle(fontSize: 50),
                      group: myGroup,
                    ),
                  ),
                ),
...