implemented first version of the round view
This commit is contained in:
@@ -327,6 +327,7 @@
|
|||||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||||
|
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||||
@@ -448,6 +449,7 @@
|
|||||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||||
|
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||||
@@ -505,6 +507,7 @@
|
|||||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||||
|
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import 'package:flutter/cupertino.dart';
|
|||||||
|
|
||||||
abstract class Styles {
|
abstract class Styles {
|
||||||
static Color primaryColor = CupertinoColors.systemGreen;
|
static Color primaryColor = CupertinoColors.systemGreen;
|
||||||
|
static Color backgroundColor = Color(0x00014b00);
|
||||||
|
|
||||||
static TextStyle modeTitle = TextStyle(
|
static TextStyle modeTitle = TextStyle(
|
||||||
color: primaryColor,
|
color: primaryColor,
|
||||||
@@ -18,4 +19,16 @@ abstract class Styles {
|
|||||||
color: primaryColor,
|
color: primaryColor,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
static TextStyle roundTitle = TextStyle(
|
||||||
|
fontSize: 60,
|
||||||
|
color: CupertinoColors.white,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
);
|
||||||
|
|
||||||
|
static TextStyle roundPlayers = TextStyle(
|
||||||
|
fontSize: 20,
|
||||||
|
color: CupertinoColors.white,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import 'package:cabo_counter/data_classes/game_session.dart';
|
import 'package:cabo_counter/data_classes/game_session.dart';
|
||||||
import 'package:cabo_counter/utility/styles.dart';
|
import 'package:cabo_counter/utility/styles.dart';
|
||||||
|
import 'package:cabo_counter/views/round_view.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
|
|
||||||
class ActiveGameView extends StatefulWidget {
|
class ActiveGameView extends StatefulWidget {
|
||||||
@@ -71,15 +72,26 @@ class _ActiveGameViewState extends State<ActiveGameView> {
|
|||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
itemCount: widget.gameSession.playerScores[0].length,
|
itemCount: widget.gameSession.playerScores[0].length,
|
||||||
itemBuilder: (BuildContext context, int index) {
|
itemBuilder: (BuildContext context, int index) {
|
||||||
return CupertinoListTile(
|
return GestureDetector(
|
||||||
title: Text(
|
onTap: () {
|
||||||
'Runde ${index + 1}',
|
Navigator.push(
|
||||||
),
|
context,
|
||||||
trailing:
|
CupertinoPageRoute(
|
||||||
index + 1 == widget.gameSession.playerScores[0].length
|
builder: (context) => RoundView(
|
||||||
? Text('⏳', style: TextStyle(fontSize: 22))
|
gameSession: widget.gameSession,
|
||||||
: Text('✅', style: TextStyle(fontSize: 22)),
|
roundNumber: index + 1),
|
||||||
);
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: CupertinoListTile(
|
||||||
|
title: Text(
|
||||||
|
'Runde ${index + 1}',
|
||||||
|
),
|
||||||
|
trailing:
|
||||||
|
index + 1 == widget.gameSession.playerScores[0].length
|
||||||
|
? Text('⏳', style: TextStyle(fontSize: 22))
|
||||||
|
: Text('✅', style: TextStyle(fontSize: 22)),
|
||||||
|
));
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -101,8 +101,8 @@ class _MainMenuViewState extends State<MainMenuView> {
|
|||||||
|
|
||||||
void randomizeRoundNumbers() {
|
void randomizeRoundNumbers() {
|
||||||
var random = Random();
|
var random = Random();
|
||||||
gameSessionArray.forEach((s) {
|
for (var s in gameSessionArray) {
|
||||||
s.round = random.nextInt(20);
|
s.round = random.nextInt(20);
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
139
lib/views/round_view.dart
Normal file
139
lib/views/round_view.dart
Normal file
@@ -0,0 +1,139 @@
|
|||||||
|
import 'package:cabo_counter/data_classes/game_session.dart';
|
||||||
|
import 'package:cabo_counter/utility/styles.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
|
||||||
|
class RoundView extends StatefulWidget {
|
||||||
|
final GameSession gameSession;
|
||||||
|
final int roundNumber;
|
||||||
|
const RoundView(
|
||||||
|
{super.key, required this.roundNumber, required this.gameSession});
|
||||||
|
|
||||||
|
@override
|
||||||
|
// ignore: library_private_types_in_public_api
|
||||||
|
_RoundViewState createState() => _RoundViewState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _RoundViewState extends State<RoundView> {
|
||||||
|
late final List<bool> _isKamikazeChecked =
|
||||||
|
List.filled(widget.gameSession.players.length, false);
|
||||||
|
late final List<TextEditingController> _pointControllers =
|
||||||
|
List.filled(widget.gameSession.players.length, TextEditingController());
|
||||||
|
late final List<bool> _hasSaidCabo =
|
||||||
|
List.filled(widget.gameSession.players.length, false);
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
print('Runde ${widget.roundNumber} geöffnet');
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return CupertinoPageScaffold(
|
||||||
|
backgroundColor: Styles.backgroundColor,
|
||||||
|
navigationBar: const CupertinoNavigationBar(
|
||||||
|
transitionBetweenRoutes: true,
|
||||||
|
middle: Text('Ergebnisse'),
|
||||||
|
previousPageTitle: 'Zurück',
|
||||||
|
),
|
||||||
|
child: SafeArea(
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.fromLTRB(0, 50, 0, 50),
|
||||||
|
child: Text(
|
||||||
|
'Runde ${widget.roundNumber}',
|
||||||
|
style: Styles.roundTitle,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.fromLTRB(0, 0, 0, 5),
|
||||||
|
child: CupertinoListTile(
|
||||||
|
title: Row(
|
||||||
|
children: [
|
||||||
|
Text('Name'),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
trailing: Row(
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
width: 100,
|
||||||
|
child: Center(child: Text('Punkte')),
|
||||||
|
),
|
||||||
|
SizedBox(width: 20),
|
||||||
|
SizedBox(
|
||||||
|
width: 70,
|
||||||
|
child: Center(child: Text('Kamikaze')),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
ListView.builder(
|
||||||
|
shrinkWrap: true,
|
||||||
|
itemCount: widget.gameSession.players.length,
|
||||||
|
itemBuilder: (BuildContext context, int index) {
|
||||||
|
return Padding(
|
||||||
|
padding:
|
||||||
|
EdgeInsets.symmetric(vertical: 10.0, horizontal: 20.0),
|
||||||
|
child: ClipRRect(
|
||||||
|
borderRadius:
|
||||||
|
BorderRadius.circular(12), // Radius der Ecken
|
||||||
|
child: CupertinoListTile(
|
||||||
|
backgroundColor: CupertinoColors.secondaryLabel,
|
||||||
|
title: Row(
|
||||||
|
children: [
|
||||||
|
Text(widget.gameSession.players[index]),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
subtitle: Text(
|
||||||
|
'${widget.gameSession.playerScores[index][widget.roundNumber - 1]} Punkte',
|
||||||
|
),
|
||||||
|
leading: CupertinoRadio(
|
||||||
|
value: _hasSaidCabo[index],
|
||||||
|
groupValue: _hasSaidCabo,
|
||||||
|
onChanged: (value) {
|
||||||
|
setState(() {
|
||||||
|
_hasSaidCabo[index] = true;
|
||||||
|
});
|
||||||
|
}),
|
||||||
|
trailing: Row(
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
width: 100,
|
||||||
|
child: CupertinoTextField(
|
||||||
|
keyboardType: TextInputType.number,
|
||||||
|
controller: _pointControllers[index],
|
||||||
|
placeholder: 'Punkte',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
onChanged: (value) {
|
||||||
|
widget.gameSession.playerScores[index]
|
||||||
|
[widget.roundNumber - 1] =
|
||||||
|
int.parse(value);
|
||||||
|
},
|
||||||
|
)),
|
||||||
|
SizedBox(width: 20),
|
||||||
|
SizedBox(
|
||||||
|
width: 50,
|
||||||
|
child: CupertinoCheckbox(
|
||||||
|
activeColor: Styles.primaryColor,
|
||||||
|
tristate: false,
|
||||||
|
value: _isKamikazeChecked[index],
|
||||||
|
onChanged: (bool? value) {
|
||||||
|
print('value: $value');
|
||||||
|
setState(() {
|
||||||
|
_isKamikazeChecked[index] = value!;
|
||||||
|
print(
|
||||||
|
'Kamikaze checked: ${_isKamikazeChecked[index]}');
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
))));
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)));
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user