【问题标题】:Flutter web Instance of 'minified:eU<void>'Flutter web 'minified:eU<void>' 实例
【发布时间】:2021-06-22 09:55:48
【问题描述】:

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

我看到了这个:



而不是这个:

如您所见,这是一个 alertDialog,下面是它的代码: 类 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),
              ))
        ],
      ),
    );
  }
}

我发现灰色框是红屏死机的发布版本。在那之后,我检查了,注入的变量都不是空的。 debug只有一个问题:

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

【问题讨论】:

    标签: flutter dart null hosting release


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 2020-04-02
      • 1970-01-01
      • 2023-02-11
      • 2016-10-27
      • 2021-07-11
      • 2020-03-05
      • 2012-12-13
      • 2021-07-10
      • 1970-01-01
      相关资源
      最近更新 更多