MVP #141
@@ -239,7 +239,7 @@ class _CreateMatchViewState extends State<CreateMatchView> {
|
|||||||
context,
|
context,
|
||||||
CupertinoPageRoute(
|
CupertinoPageRoute(
|
||||||
fullscreenDialog: true,
|
fullscreenDialog: true,
|
||||||
builder: (context) => GameResultView(
|
builder: (context) => MatchResultView(
|
||||||
match: match,
|
match: match,
|
||||||
onWinnerChanged: widget.onWinnerChanged,
|
onWinnerChanged: widget.onWinnerChanged,
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -6,17 +6,17 @@ import 'package:game_tracker/data/dto/player.dart';
|
|||||||
import 'package:game_tracker/presentation/widgets/tiles/custom_radio_list_tile.dart';
|
import 'package:game_tracker/presentation/widgets/tiles/custom_radio_list_tile.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class GameResultView extends StatefulWidget {
|
class MatchResultView extends StatefulWidget {
|
||||||
final Match match;
|
final Match match;
|
||||||
|
|
||||||
final VoidCallback? onWinnerChanged;
|
final VoidCallback? onWinnerChanged;
|
||||||
|
|
||||||
const GameResultView({super.key, required this.match, this.onWinnerChanged});
|
const MatchResultView({super.key, required this.match, this.onWinnerChanged});
|
||||||
@override
|
@override
|
||||||
State<GameResultView> createState() => _GameResultViewState();
|
State<MatchResultView> createState() => _MatchResultViewState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _GameResultViewState extends State<GameResultView> {
|
class _MatchResultViewState extends State<MatchResultView> {
|
||||||
late final List<Player> allPlayers;
|
late final List<Player> allPlayers;
|
||||||
late final AppDatabase db;
|
late final AppDatabase db;
|
||||||
Player? _selectedPlayer;
|
Player? _selectedPlayer;
|
||||||
@@ -142,12 +142,12 @@ class _GameResultViewState extends State<GameResultView> {
|
|||||||
widget.onWinnerChanged?.call();
|
widget.onWinnerChanged?.call();
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Player> getAllPlayers(Match game) {
|
List<Player> getAllPlayers(Match match) {
|
||||||
if (game.group == null && game.players != null) {
|
if (match.group == null && match.players != null) {
|
||||||
return [...game.players!];
|
return [...match.players!];
|
||||||
} else if (game.group != null && game.players != null) {
|
} else if (match.group != null && match.players != null) {
|
||||||
return [...game.players!, ...game.group!.members];
|
return [...match.players!, ...match.group!.members];
|
||||||
}
|
}
|
||||||
return [...game.group!.members];
|
return [...match.group!.members];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ class _MatchViewState extends State<MatchView> {
|
|||||||
context,
|
context,
|
||||||
CupertinoPageRoute(
|
CupertinoPageRoute(
|
||||||
fullscreenDialog: true,
|
fullscreenDialog: true,
|
||||||
builder: (context) => GameResultView(
|
builder: (context) => MatchResultView(
|
||||||
match: matches[index],
|
match: matches[index],
|
||||||
onWinnerChanged: loadGames,
|
onWinnerChanged: loadGames,
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user