颤动中构建发布中的应用程序屏幕渲染问题

App Screen Render Issue in build-release in flutter

我正在做一个 Flutter 项目,里面的一切都非常完美,这个问题只出现在一个屏幕上 当我 运行 处于调试模式时,屏幕呈现正确,但是当我构建 APk 并安装它时,我 运行 遇到了这个问题。

class levels extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return WillPopScope(
      onWillPop: (){
        return
        Navigator.of(context).pushReplacement(MaterialPageRoute(
            builder: (context) => HomeScreen(),
        ),
        );
      },
        child: MaterialApp(
          home: Scaffold(
            appBar: new AppBar(
              title: Text(
                'Marketer Level',
                style: TextStyle(fontSize: 20.0),
              ),
              backgroundColor: Colors.amber[800],

            ),
            body: SingleChildScrollView(
              child: Column(
                mainAxisAlignment: MainAxisAlignment.start,
                crossAxisAlignment: CrossAxisAlignment.center,
                children: [
                  Container(
                    width: MediaQuery. of(context). size. width,
                    child: Expanded(
                      child: DataTable(
                        columns: const <DataColumn>[
                          DataColumn(
                            label: Text(
                              'Referrals',
                              style: TextStyle(fontStyle: FontStyle.italic,
                              fontWeight: FontWeight.bold,
                              fontSize: 15,),
                            ),
                          ),
                          DataColumn(
                            label: Text(
                              'Level',
                              style: TextStyle(fontStyle: FontStyle.italic,
                                fontWeight: FontWeight.bold,
                                fontSize: 15,),
                            ),
                          ),
                          DataColumn(
                            label: Text(
                              'Icon',
                              style: TextStyle(fontStyle: FontStyle.italic,
                                fontWeight: FontWeight.bold,
                                fontSize: 15,),
                            ),
                          ),

                        ],
                        rows: const <DataRow>[

                          DataRow(
                            cells: <DataCell>[
                              DataCell(Text('0-100',style: TextStyle(fontSize: 15),)),
                              DataCell(Text("Bronze V")),
                              DataCell(Icon(MdiIcons.medal,
                                color: Colors.brown,
                                size: 20,))

                            ],
                          ),
                          DataRow(
                            cells: <DataCell>[
                              DataCell(Text('100-200',style: TextStyle(fontSize: 15),)),
                              DataCell(Text("Bronze IV")),
                              DataCell(Icon(MdiIcons.medal,
                                color: Colors.brown,
                                size: 20,))

                            ],
                          ),
                          DataRow(
                            cells: <DataCell>[
                              DataCell(Text('200-300',style: TextStyle(fontSize: 15),)),
                              DataCell(Text("Bronze III")),
                              DataCell(Icon(MdiIcons.medal,
                                color: Colors.brown,
                                size: 20,))

                            ],
                          ),DataRow(
                            cells: <DataCell>[
                              DataCell(Text('300-400',style: TextStyle(fontSize: 15),)),
                              DataCell(Text("Bronze II")),
                              DataCell(Icon(MdiIcons.medal,
                                color: Colors.brown,
                                size: 20,))

                            ],
                          ),DataRow(
                            cells: <DataCell>[
                              DataCell(Text('400-500',style: TextStyle(fontSize: 15),)),
                              DataCell(Text("Bronze I")),
                              DataCell(Icon(MdiIcons.medal,
                                color: Colors.brown,
                                size: 20,))

                            ],
                          ),
                          DataRow(
                            cells: <DataCell>[
                              DataCell(Text('500-600',style: TextStyle(fontSize: 15),)),
                              DataCell(Text("Silver V")),
                              DataCell(Icon(MdiIcons.medal,
                                color: Colors.blueGrey,
                                size: 20,))

                            ],
                          ),
                          DataRow(
                            cells: <DataCell>[
                              DataCell(Text('600-700',style: TextStyle(fontSize: 15),)),
                              DataCell(Text("Silver IV")),
                              DataCell(Icon(MdiIcons.medal,
                                color: Colors.blueGrey,
                                size: 20,))

                            ],
                          ),
                          DataRow(
                            cells: <DataCell>[
                              DataCell(Text('700-800',style: TextStyle(fontSize: 15),)),
                              DataCell(Text("Silver III")),
                              DataCell(Icon(MdiIcons.medal,
                                color: Colors.blueGrey,
                                size: 20,))

                            ],
                          ),
                          DataRow(
                            cells: <DataCell>[
                              DataCell(Text('800-900',style: TextStyle(fontSize: 15),)),
                              DataCell(Text("Silver II")),
                              DataCell(Icon(MdiIcons.medal,
                                color: Colors.blueGrey,
                                size: 20,))

                            ],
                          ),
                          DataRow(
                            cells: <DataCell>[
                              DataCell(Text('900-1000',style: TextStyle(fontSize: 15),)),
                              DataCell(Text("Silver I")),
                              DataCell(Icon(MdiIcons.medal,
                                color: Colors.blueGrey,
                                size: 20,))

                            ],
                          ),
                          DataRow(
                            cells: <DataCell>[
                              DataCell(Text('1000-1100',style: TextStyle(fontSize: 15),)),
                              DataCell(Text("Gold V")),
                              DataCell(Icon(MdiIcons.medal,
                                color: Colors.yellowAccent,
                                size: 20,))

                            ],
                          ),
                          DataRow(
                            cells: <DataCell>[
                              DataCell(Text('1000-1100',style: TextStyle(fontSize: 15),)),
                              DataCell(Text("Gold V")),
                              DataCell(Icon(MdiIcons.medal,
                                color: Colors.yellowAccent,
                                size: 20,))

                            ],
                          ),
                          DataRow(
                            cells: <DataCell>[
                              DataCell(Text('1100-1200',style: TextStyle(fontSize: 15),)),
                              DataCell(Text("Gold IV")),
                              DataCell(Icon(MdiIcons.medal,
                                color: Colors.yellowAccent,
                                size: 20,))

                            ],
                          ),
                          DataRow(
                            cells: <DataCell>[
                              DataCell(Text('1200-1300',style: TextStyle(fontSize: 15),)),
                              DataCell(Text("Gold III")),
                              DataCell(Icon(MdiIcons.medal,
                                color: Colors.yellowAccent,
                                size: 20,))

                            ],
                          ),
                          DataRow(
                            cells: <DataCell>[
                              DataCell(Text('1300-1400',style: TextStyle(fontSize: 15),)),
                              DataCell(Text("Gold II")),
                              DataCell(Icon(MdiIcons.medal,
                                color: Colors.yellowAccent,
                                size: 20,))

                            ],
                          ),
                          DataRow(
                            cells: <DataCell>[
                              DataCell(Text('1400-1500',style: TextStyle(fontSize: 15),)),
                              DataCell(Text("Gold I")),
                              DataCell(Icon(MdiIcons.medal,
                                color: Colors.yellowAccent,
                                size: 20,))

                            ],
                          ),
                          DataRow(
                            cells: <DataCell>[
                              DataCell(Text('1500+',style: TextStyle(fontSize: 15),)),
                              DataCell(Text("Diamon")),
                              DataCell(Icon(MdiIcons.diamond,
                                color: Colors.blue,
                                size: 20,))

                            ],
                          ),

                        ],
                      ),
                    ),
                  )
                ],
              ),
            )
          ),
        ));
  }
}

如果有人能解决这个问题,我将不胜感激。

Container(
                    width: MediaQuery. of(context). size. width,
                    child:  DataTable(
                        columns: const <DataColumn>[
                          DataColumn(
                            label: Text(
                              'Referrals',
                              style: TextStyle(fontStyle: FontStyle.italic,
                              fontWeight: FontWeight.bold,
                              fontSize: 15,),
                            ),
                          ),
                          DataColumn(
                            label: Text(
                              'Level',
                              style: TextStyle(fontStyle: FontStyle.italic,
                                fontWeight: FontWeight.bold,
                                fontSize: 15,),
                            ),
                          ),
                          DataColumn(
                            label: Text(
                              'Icon',
                              style: TextStyle(fontStyle: FontStyle.italic,
                                fontWeight: FontWeight.bold,
                                fontSize: 15,),
                            ),
                          ),

                        ],
                        rows: const <DataRow>[

                          DataRow(
                            cells: <DataCell>[
                              DataCell(Text('0-100',style: TextStyle(fontSize: 15),)),
                              DataCell(Text("Bronze V")),
                              DataCell(Icon(MdiIcons.medal,
                                color: Colors.brown,
                                size: 20,))

                            ],
                          ),
                          DataRow(
                            cells: <DataCell>[
                              DataCell(Text('100-200',style: TextStyle(fontSize: 15),)),
                              DataCell(Text("Bronze IV")),
                              DataCell(Icon(MdiIcons.medal,
                                color: Colors.brown,
                                size: 20,))

                            ],
                          ),
                          DataRow(
                            cells: <DataCell>[
                              DataCell(Text('200-300',style: TextStyle(fontSize: 15),)),
                              DataCell(Text("Bronze III")),
                              DataCell(Icon(MdiIcons.medal,
                                color: Colors.brown,
                                size: 20,))

                            ],
                          ),DataRow(
                            cells: <DataCell>[
                              DataCell(Text('300-400',style: TextStyle(fontSize: 15),)),
                              DataCell(Text("Bronze II")),
                              DataCell(Icon(MdiIcons.medal,
                                color: Colors.brown,
                                size: 20,))

                            ],
                          ),DataRow(
                            cells: <DataCell>[
                              DataCell(Text('400-500',style: TextStyle(fontSize: 15),)),
                              DataCell(Text("Bronze I")),
                              DataCell(Icon(MdiIcons.medal,
                                color: Colors.brown,
                                size: 20,))

                            ],
                          ),
                          DataRow(
                            cells: <DataCell>[
                              DataCell(Text('500-600',style: TextStyle(fontSize: 15),)),
                              DataCell(Text("Silver V")),
                              DataCell(Icon(MdiIcons.medal,
                                color: Colors.blueGrey,
                                size: 20,))

                            ],
                          ),
                          DataRow(
                            cells: <DataCell>[
                              DataCell(Text('600-700',style: TextStyle(fontSize: 15),)),
                              DataCell(Text("Silver IV")),
                              DataCell(Icon(MdiIcons.medal,
                                color: Colors.blueGrey,
                                size: 20,))

                            ],
                          ),
                          DataRow(
                            cells: <DataCell>[
                              DataCell(Text('700-800',style: TextStyle(fontSize: 15),)),
                              DataCell(Text("Silver III")),
                              DataCell(Icon(MdiIcons.medal,
                                color: Colors.blueGrey,
                                size: 20,))

                            ],
                          ),
                          DataRow(
                            cells: <DataCell>[
                              DataCell(Text('800-900',style: TextStyle(fontSize: 15),)),
                              DataCell(Text("Silver II")),
                              DataCell(Icon(MdiIcons.medal,
                                color: Colors.blueGrey,
                                size: 20,))

                            ],
                          ),
                          DataRow(
                            cells: <DataCell>[
                              DataCell(Text('900-1000',style: TextStyle(fontSize: 15),)),
                              DataCell(Text("Silver I")),
                              DataCell(Icon(MdiIcons.medal,
                                color: Colors.blueGrey,
                                size: 20,))

                            ],
                          ),
                          DataRow(
                            cells: <DataCell>[
                              DataCell(Text('1000-1100',style: TextStyle(fontSize: 15),)),
                              DataCell(Text("Gold V")),
                              DataCell(Icon(MdiIcons.medal,
                                color: Colors.yellowAccent,
                                size: 20,))

                            ],
                          ),
                          DataRow(
                            cells: <DataCell>[
                              DataCell(Text('1000-1100',style: TextStyle(fontSize: 15),)),
                              DataCell(Text("Gold V")),
                              DataCell(Icon(MdiIcons.medal,
                                color: Colors.yellowAccent,
                                size: 20,))

                            ],
                          ),
                          DataRow(
                            cells: <DataCell>[
                              DataCell(Text('1100-1200',style: TextStyle(fontSize: 15),)),
                              DataCell(Text("Gold IV")),
                              DataCell(Icon(MdiIcons.medal,
                                color: Colors.yellowAccent,
                                size: 20,))

                            ],
                          ),
                          DataRow(
                            cells: <DataCell>[
                              DataCell(Text('1200-1300',style: TextStyle(fontSize: 15),)),
                              DataCell(Text("Gold III")),
                              DataCell(Icon(MdiIcons.medal,
                                color: Colors.yellowAccent,
                                size: 20,))

                            ],
                          ),
                          DataRow(
                            cells: <DataCell>[
                              DataCell(Text('1300-1400',style: TextStyle(fontSize: 15),)),
                              DataCell(Text("Gold II")),
                              DataCell(Icon(MdiIcons.medal,
                                color: Colors.yellowAccent,
                                size: 20,))

                            ],
                          ),
                          DataRow(
                            cells: <DataCell>[
                              DataCell(Text('1400-1500',style: TextStyle(fontSize: 15),)),
                              DataCell(Text("Gold I")),
                              DataCell(Icon(MdiIcons.medal,
                                color: Colors.yellowAccent,
                                size: 20,))

                            ],
                          ),
                          DataRow(
                            cells: <DataCell>[
                              DataCell(Text('1500+',style: TextStyle(fontSize: 15),)),
                              DataCell(Text("Diamon")),
                              DataCell(Icon(MdiIcons.diamond,
                                color: Colors.blue,
                                size: 20,))

                            ],
                          ),

                        ],
                      ),
                    ),
                ],
              ),

在没有扩展小部件的情况下试试 这可能是因为您错误地使用了在调试模式下存在的父窗口小部件错误,您忽略了它,因此它将进入发布模式