diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index e7c35c1..a5a0ed4 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -327,6 +327,7 @@ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; @@ -448,6 +449,7 @@ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; @@ -505,6 +507,7 @@ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; diff --git a/lib/utility/styles.dart b/lib/utility/styles.dart index d28de2e..f69422e 100644 --- a/lib/utility/styles.dart +++ b/lib/utility/styles.dart @@ -2,6 +2,7 @@ import 'package:flutter/cupertino.dart'; abstract class Styles { static Color primaryColor = CupertinoColors.systemGreen; + static Color backgroundColor = Color(0x00014b00); static TextStyle modeTitle = TextStyle( color: primaryColor, @@ -18,4 +19,16 @@ abstract class Styles { color: primaryColor, 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, + ); } diff --git a/lib/views/active_game_view.dart b/lib/views/active_game_view.dart index c689f07..61a4b99 100644 --- a/lib/views/active_game_view.dart +++ b/lib/views/active_game_view.dart @@ -1,5 +1,6 @@ import 'package:cabo_counter/data_classes/game_session.dart'; import 'package:cabo_counter/utility/styles.dart'; +import 'package:cabo_counter/views/round_view.dart'; import 'package:flutter/cupertino.dart'; class ActiveGameView extends StatefulWidget { @@ -71,15 +72,26 @@ class _ActiveGameViewState extends State { shrinkWrap: true, itemCount: widget.gameSession.playerScores[0].length, itemBuilder: (BuildContext context, int index) { - return CupertinoListTile( - title: Text( - 'Runde ${index + 1}', - ), - trailing: - index + 1 == widget.gameSession.playerScores[0].length - ? Text('⏳', style: TextStyle(fontSize: 22)) - : Text('✅', style: TextStyle(fontSize: 22)), - ); + return GestureDetector( + onTap: () { + Navigator.push( + context, + CupertinoPageRoute( + builder: (context) => RoundView( + gameSession: widget.gameSession, + 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)), + )); }, ), ], diff --git a/lib/views/main_menu_view.dart b/lib/views/main_menu_view.dart index 4b5ab4e..b1dc22a 100644 --- a/lib/views/main_menu_view.dart +++ b/lib/views/main_menu_view.dart @@ -101,8 +101,8 @@ class _MainMenuViewState extends State { void randomizeRoundNumbers() { var random = Random(); - gameSessionArray.forEach((s) { + for (var s in gameSessionArray) { s.round = random.nextInt(20); - }); + } } } diff --git a/lib/views/round_view.dart b/lib/views/round_view.dart new file mode 100644 index 0000000..1278eb8 --- /dev/null +++ b/lib/views/round_view.dart @@ -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 { + late final List _isKamikazeChecked = + List.filled(widget.gameSession.players.length, false); + late final List _pointControllers = + List.filled(widget.gameSession.players.length, TextEditingController()); + late final List _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]}'); + }); + }, + ), + ), + ], + )))); + }, + ), + ], + ))); + } +}