'minified:eU<void>' 的颤振网络实例

时间:2021-06-22 09:55:48

标签: flutter dart null hosting release

我正在构建一个 Flutter Web 应用程序,它可以在调试模式下完美运行,但是每当我尝试在发布模式下运行它或将其部署到主机时,我都会看到一个灰色框。

我看到了: enter image description here



而不是这样:

enter image description here

如你所见,这是一个alertDialog,下面是它的代码: class TeamDetailsDialog 扩展了 StatelessWidget {

final Tournament tournament;
  final Team team;
  final String matchId;

  TeamDetailsDialog(this.team, this.matchId, this.tournament);

  @override
  Widget build(BuildContext context) {
    return Theme(
      data: ThemeData(buttonBarTheme: ButtonBarThemeData(alignment: MainAxisAlignment.spaceBetween)),
      child: AlertDialog(
        backgroundColor: Color(0xFF333D81),
        title: Text(
          "Csapatnév: ${team.name}",
          style: TextStyle(color: Colors.white),
        ),
        content: DefaultTextStyle(
          style: TextStyle(color: Colors.white),
          child: Column(
            mainAxisSize: MainAxisSize.min,
            children: [
              Padding(
                padding: const EdgeInsets.only(bottom: 8.0),
                child: Align(alignment: Alignment.centerLeft, child: Text("A csapat tagjai:")),
              ),
              for (Player player in team.players) Text("${player.displayName}(${player.inGameDisplayName})")
            ],
          ),
        ),
        actions: [
          TextButton(
              onPressed: () => Navigator.pop(context),
              child: Text(
                "Bezárás",
                style: TextStyle(color: Colors.white),
              )),
          Spacer(),
          TextButton(
              onPressed: () {
                // Retrieving the match object from the Cubit.
                final Match matchWithoutWinner =
                    BlocProvider.of<TournamentCubit>(context).getMatchOfTournamentById(tournament, matchId);
                // Creating a new match instance containing the winner team.
                if (matchWithoutWinner is DoubleEliminationLoserBranchMatch) {
                  final DoubleEliminationLoserBranchMatch matchWithWinner = DoubleEliminationLoserBranchMatch(
                      matchWithoutWinner.id,
                      matchWithoutWinner.team1,
                      matchWithoutWinner.team2,
                      team,
                      matchWithoutWinner.parent1id,
                      matchWithoutWinner.parent2id);
                  BlocProvider.of<TournamentCubit>(context).setWinnerOfMatch(tournament, matchWithWinner);
                }
                else {
                  final Match matchWithWinner = Match(matchWithoutWinner.id, matchWithoutWinner.team1,
                      matchWithoutWinner.team2, team, matchWithoutWinner.parent1id, matchWithoutWinner.parent2id);
                  BlocProvider.of<TournamentCubit>(context).setWinnerOfMatch(tournament, matchWithWinner);
                }
                Navigator.pop(context);
              },
              child: Text(
                "Beállítás győztesnek",
                style: TextStyle(color: Colors.white),
              ))
        ],
      ),
    );
  }
}

我发现灰色框是死亡红屏的发布版本。在那之后,我检查了,没有一个注入的变量是空的。调试中只有一个问题: enter image description here

可能是什么问题?这会导致问题吗?我该如何解决?

1 个答案:

答案 0 :(得分:0)

问题的原因是操作列表中两个按钮之间的 Spacer(),删除它可以解决问题,而无需更改 UI。