'minified:eU<void>' 的 Flutter web 实例
Flutter web Instance of 'minified:eU<void>'
我正在构建一个 Flutter 网络应用程序,它 运行 在调试模式下完美无缺,但每当我尝试 运行 在发布模式下或将其部署到主机时,我都会看到一个灰色框.
我看到了这个:
而不是这个:
如你所见,这是一个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),
))
],
),
);
}
}
我查到灰框是死红屏的release版本。之后,我检查了,none 的注入变量是空的。调试中只有一个问题:
可能是什么问题?这会导致问题吗?我该如何解决?
问题的原因是操作列表中两个按钮之间的 Spacer(),删除它解决了问题,而不更改 UI。
我正在构建一个 Flutter 网络应用程序,它 运行 在调试模式下完美无缺,但每当我尝试 运行 在发布模式下或将其部署到主机时,我都会看到一个灰色框.
我看到了这个:
而不是这个:
如你所见,这是一个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),
))
],
),
);
}
}
我查到灰框是死红屏的release版本。之后,我检查了,none 的注入变量是空的。调试中只有一个问题:
可能是什么问题?这会导致问题吗?我该如何解决?
问题的原因是操作列表中两个按钮之间的 Spacer(),删除它解决了问题,而不更改 UI。