First version of inserting into db
This commit is contained in:
@@ -146,7 +146,7 @@ class _RoundViewState extends State<RoundView> {
|
||||
.entries
|
||||
.map((entry) {
|
||||
final index = entry.key;
|
||||
final name = entry.value;
|
||||
final player = entry.value;
|
||||
return MapEntry(
|
||||
index,
|
||||
Padding(
|
||||
@@ -157,7 +157,7 @@ class _RoundViewState extends State<RoundView> {
|
||||
child: FittedBox(
|
||||
fit: BoxFit.scaleDown,
|
||||
child: Text(
|
||||
name,
|
||||
player.name,
|
||||
textAlign: TextAlign.center,
|
||||
maxLines: 1,
|
||||
style: const TextStyle(
|
||||
@@ -210,7 +210,7 @@ class _RoundViewState extends State<RoundView> {
|
||||
]))
|
||||
]),
|
||||
subtitle: Text(
|
||||
'${widget.gameSession.playerScores[originalIndex]}'
|
||||
'${widget.gameSession.getPlayerScoresAsList()[originalIndex]}'
|
||||
' ${AppLocalizations.of(context).points}'),
|
||||
trailing: SizedBox(
|
||||
width: 100,
|
||||
@@ -329,10 +329,11 @@ class _RoundViewState extends State<RoundView> {
|
||||
/// Rotates the players list based on the previous round's winner.
|
||||
List<String> _getRotatedPlayers() {
|
||||
final winnerIndex = _getPreviousRoundWinnerIndex();
|
||||
final playerList = widget.gameSession.getPlayerNamesAsList();
|
||||
return [
|
||||
widget.gameSession.players[winnerIndex],
|
||||
...widget.gameSession.players.sublist(winnerIndex + 1),
|
||||
...widget.gameSession.players.sublist(0, winnerIndex)
|
||||
playerList[winnerIndex],
|
||||
...playerList.sublist(winnerIndex + 1),
|
||||
...playerList.sublist(0, winnerIndex)
|
||||
];
|
||||
}
|
||||
|
||||
@@ -358,14 +359,14 @@ class _RoundViewState extends State<RoundView> {
|
||||
message: Text(AppLocalizations.of(context).who_has_kamikaze),
|
||||
actions: widget.gameSession.players.asMap().entries.map((entry) {
|
||||
final index = entry.key;
|
||||
final name = entry.value;
|
||||
final player = entry.value;
|
||||
return CupertinoActionSheetAction(
|
||||
onPressed: () {
|
||||
_kamikazePlayerIndex = index;
|
||||
Navigator.pop(context, true);
|
||||
},
|
||||
child: Text(
|
||||
name,
|
||||
player.name,
|
||||
style: TextStyle(color: CustomTheme.kamikazeColor),
|
||||
),
|
||||
);
|
||||
@@ -494,7 +495,7 @@ class _RoundViewState extends State<RoundView> {
|
||||
String _getBonusPopupMessageString(
|
||||
int pointLimit, int bonusPoints, List<int> bonusPlayers) {
|
||||
List<String> nameList =
|
||||
bonusPlayers.map((i) => widget.gameSession.players[i]).toList();
|
||||
bonusPlayers.map((i) => widget.gameSession.players[i].name).toList();
|
||||
String resultText = '';
|
||||
if (nameList.length == 1) {
|
||||
resultText = AppLocalizations.of(context).bonus_points_message(
|
||||
|
||||
Reference in New Issue
Block a user