Renamed folder & fixed gesture detector
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import 'package:cabo_counter/data_classes/game_session.dart';
|
||||
import 'package:cabo_counter/data/game_session.dart';
|
||||
|
||||
class Globals {
|
||||
static Map<int, GameSession> gamesMap = <int, GameSession>{};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import 'package:cabo_counter/data_classes/game_session.dart';
|
||||
import 'package:cabo_counter/data/game_session.dart';
|
||||
import 'package:cabo_counter/utility/theme.dart' as theme;
|
||||
import 'package:cabo_counter/views/round_view.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
@@ -70,18 +70,8 @@ class _ActiveGameViewState extends State<ActiveGameView> {
|
||||
shrinkWrap: true,
|
||||
itemCount: widget.gameSession.playerScores[0].length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
CupertinoPageRoute(
|
||||
fullscreenDialog: true,
|
||||
builder: (context) => RoundView(
|
||||
gameSession: widget.gameSession,
|
||||
roundNumber: index + 1),
|
||||
),
|
||||
);
|
||||
},
|
||||
return Padding(
|
||||
padding: EdgeInsets.all(1),
|
||||
child: CupertinoListTile(
|
||||
title: Text(
|
||||
'Runde ${index + 1}',
|
||||
@@ -90,6 +80,17 @@ class _ActiveGameViewState extends State<ActiveGameView> {
|
||||
index + 1 == widget.gameSession.playerScores[0].length
|
||||
? Text('⏳', style: TextStyle(fontSize: 22))
|
||||
: Text('✅', style: TextStyle(fontSize: 22)),
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
CupertinoPageRoute(
|
||||
fullscreenDialog: true,
|
||||
builder: (context) => RoundView(
|
||||
gameSession: widget.gameSession,
|
||||
roundNumber: index + 1),
|
||||
),
|
||||
);
|
||||
},
|
||||
));
|
||||
},
|
||||
),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import 'package:cabo_counter/data_classes/game_session.dart';
|
||||
import 'package:cabo_counter/data/game_session.dart';
|
||||
import 'package:cabo_counter/utility/styles.dart';
|
||||
import 'package:cabo_counter/views/active_game_view.dart';
|
||||
import 'package:cabo_counter/views/mode_selection_view.dart';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:cabo_counter/data_classes/game_session.dart';
|
||||
import 'package:cabo_counter/data/game_session.dart';
|
||||
import 'package:cabo_counter/views/active_game_view.dart';
|
||||
import 'package:cabo_counter/views/create_game_view.dart';
|
||||
import 'package:cabo_counter/views/information_view.dart';
|
||||
@@ -73,36 +73,33 @@ class _MainMenuViewState extends State<MainMenuView> {
|
||||
itemCount: gameSessionArray.length,
|
||||
itemBuilder: (context, index) {
|
||||
final session = gameSessionArray[index];
|
||||
return GestureDetector(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 10.0),
|
||||
child: CupertinoListTile(
|
||||
title: Text(session.gameTitle),
|
||||
leading: session.gameMode.toInt() == 0
|
||||
? Icon(CupertinoIcons.hare_fill)
|
||||
: Icon(CupertinoIcons.time_solid),
|
||||
subtitle: Text('Gewinner*in: ${session.winner}'),
|
||||
trailing: Row(
|
||||
children: [
|
||||
Text('${session.round}'),
|
||||
SizedBox(width: 3),
|
||||
Icon(CupertinoIcons.arrow_2_circlepath_circle_fill),
|
||||
SizedBox(width: 6),
|
||||
Text('${session.players.length}'),
|
||||
SizedBox(width: 3),
|
||||
Icon(CupertinoIcons.person_2_fill),
|
||||
],
|
||||
return Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 10.0),
|
||||
child: CupertinoListTile(
|
||||
title: Text(session.gameTitle),
|
||||
subtitle:
|
||||
Text('Modus: ${_translateGameMode(session.gameMode)}'),
|
||||
trailing: Row(
|
||||
children: [
|
||||
Text('${session.round}'),
|
||||
SizedBox(width: 3),
|
||||
Icon(CupertinoIcons.arrow_2_circlepath_circle_fill),
|
||||
SizedBox(width: 15),
|
||||
Text('${session.players.length}'),
|
||||
SizedBox(width: 3),
|
||||
Icon(CupertinoIcons.person_2_fill),
|
||||
],
|
||||
),
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
CupertinoPageRoute(
|
||||
builder: (context) => ActiveGameView(
|
||||
gameSession: gameSessionArray[index]),
|
||||
),
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
CupertinoPageRoute(
|
||||
builder: (context) => ActiveGameView(
|
||||
gameSession: gameSessionArray[index]),
|
||||
),
|
||||
);
|
||||
},
|
||||
)));
|
||||
);
|
||||
},
|
||||
));
|
||||
},
|
||||
),
|
||||
),
|
||||
@@ -110,6 +107,17 @@ class _MainMenuViewState extends State<MainMenuView> {
|
||||
);
|
||||
}
|
||||
|
||||
String _translateGameMode(int gameMode) {
|
||||
switch (gameMode) {
|
||||
case 0:
|
||||
return '101 Punkte';
|
||||
case 1:
|
||||
return 'Unendlich';
|
||||
default:
|
||||
return '-';
|
||||
}
|
||||
}
|
||||
|
||||
void randomizeRoundNumbers() {
|
||||
var random = Random();
|
||||
for (var s in gameSessionArray) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import 'package:cabo_counter/data_classes/game_session.dart';
|
||||
import 'package:cabo_counter/data/game_session.dart';
|
||||
import 'package:cabo_counter/utility/theme.dart' as theme;
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
Reference in New Issue
Block a user