“minified:eU”的Flutter web示例< void>

fdbelqdn  于 2023-06-24  发布在  Flutter
关注(0)|答案(2)|浏览(126)

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

而不是这样:

正如你可能看到的,这是一个alertDialog,下面是它的代码:class TeamDetailsDialog extends 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中只有一个问题:

会有什么问题呢?这会导致问题吗?我该如何解决它?

qyzbxkaa

qyzbxkaa1#

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

dgsult0t

dgsult0t2#

有些东西超出了其父部件的边界,请深入检查代码,仅对行、列、flex使用expand。

相关问题