From 0d9c8a99cd3647931b059afd37d210258dfafeb0 Mon Sep 17 00:00:00 2001 From: Felix Kirchner Date: Sat, 19 Jul 2025 00:05:44 +0200 Subject: [PATCH] Added details and sum row --- .../views/point_overview_view.dart | 205 ++++++++++-------- pubspec.yaml | 2 +- 2 files changed, 116 insertions(+), 91 deletions(-) diff --git a/lib/presentation/views/point_overview_view.dart b/lib/presentation/views/point_overview_view.dart index 38d74c6..fe6373a 100644 --- a/lib/presentation/views/point_overview_view.dart +++ b/lib/presentation/views/point_overview_view.dart @@ -17,101 +17,126 @@ class _PointOverviewViewState extends State { @override Widget build(BuildContext context) { return CupertinoPageScaffold( - resizeToAvoidBottomInset: true, - navigationBar: CupertinoNavigationBar( - middle: const Text('Punkte-Übersicht'), - previousPageTitle: AppLocalizations.of(context).back, - ), - child: SingleChildScrollView( - padding: const EdgeInsets.fromLTRB(0, 100, 0, 0), - child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 8.0), - child: DataTable( - dataRowMinHeight: 60, - dataRowMaxHeight: 60, - dividerThickness: 0.5, - columnSpacing: 20, - columns: [ - const DataColumn( - numeric: true, - headingRowAlignment: MainAxisAlignment.center, - label: Text( - '#', - style: TextStyle(fontWeight: FontWeight.bold), - ), - columnWidth: IntrinsicColumnWidth(flex: 0.5)), - ...widget.gameSession.players.map( - (player) => DataColumn( - label: FittedBox( - fit: BoxFit.fill, - child: Text( - player, - style: - const TextStyle(fontWeight: FontWeight.bold), - )), - headingRowAlignment: MainAxisAlignment.center, - columnWidth: const IntrinsicColumnWidth(flex: 1)), + resizeToAvoidBottomInset: true, + navigationBar: CupertinoNavigationBar( + middle: const Text('Punkte-Übersicht'), + previousPageTitle: AppLocalizations.of(context).back, + ), + child: SingleChildScrollView( + padding: const EdgeInsets.fromLTRB(0, 100, 0, 0), + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 8.0), + child: DataTable( + dataRowMinHeight: 60, + dataRowMaxHeight: 60, + dividerThickness: 0.5, + columnSpacing: 20, + columns: [ + const DataColumn( + numeric: true, + headingRowAlignment: MainAxisAlignment.center, + label: Text( + '#', + style: TextStyle(fontWeight: FontWeight.bold), ), - ], - rows: List.generate( - widget.gameSession.roundList.length, - (roundIndex) { - final round = widget.gameSession.roundList[roundIndex]; - return DataRow( - cells: [ - DataCell(Align( - alignment: Alignment.center, - child: Text( - '$roundIndex', - style: const TextStyle(fontSize: 20), - ), + columnWidth: IntrinsicColumnWidth(flex: 0.5)), + ...widget.gameSession.players.map( + (player) => DataColumn( + label: FittedBox( + fit: BoxFit.fill, + child: Text( + player, + style: const TextStyle(fontWeight: FontWeight.bold), )), - ...List.generate(widget.gameSession.players.length, - (playerIndex) { - final score = round.scores[playerIndex]; - final update = round.scoreUpdates[playerIndex]; - final saidCabo = round.caboPlayerIndex == playerIndex - ? true - : false; - return DataCell( - Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Container( - padding: const EdgeInsets.symmetric( - horizontal: 6, vertical: 2), - decoration: BoxDecoration( - color: update <= 0 - ? CustomTheme.primaryColor - : CupertinoColors.destructiveRed, - borderRadius: BorderRadius.circular(8), - ), - child: Text( - '${update >= 0 ? '+' : '-'}$update', - style: const TextStyle( - color: CupertinoColors.white, - fontWeight: FontWeight.bold, - ), + headingRowAlignment: MainAxisAlignment.center, + columnWidth: const IntrinsicColumnWidth(flex: 1)), + ), + ], + rows: [ + ...List.generate( + widget.gameSession.roundList.length, + (roundIndex) { + final round = widget.gameSession.roundList[roundIndex]; + return DataRow( + cells: [ + DataCell(Align( + alignment: Alignment.center, + child: Text( + '$roundIndex', + style: const TextStyle(fontSize: 20), + ), + )), + ...List.generate(widget.gameSession.players.length, + (playerIndex) { + final score = round.scores[playerIndex]; + final update = round.scoreUpdates[playerIndex]; + final saidCabo = + round.caboPlayerIndex == playerIndex ? true : false; + return DataCell( + Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Container( + padding: const EdgeInsets.symmetric( + horizontal: 6, vertical: 2), + decoration: BoxDecoration( + color: update <= 0 + ? CustomTheme.primaryColor + : CupertinoColors.destructiveRed, + borderRadius: BorderRadius.circular(8), + ), + child: Text( + '${update >= 0 ? '+' : '-'}$update', + style: const TextStyle( + color: CupertinoColors.white, + fontWeight: FontWeight.bold, ), ), - const SizedBox(height: 4), - Text('$score', - style: TextStyle( - fontWeight: saidCabo - ? FontWeight.bold - : FontWeight.normal, - )), - ], - ), + ), + const SizedBox(height: 4), + Text('$score', + style: TextStyle( + fontWeight: saidCabo + ? FontWeight.bold + : FontWeight.normal, + )), + ], ), - ); - }), - ], - ); - }, - ), + ), + ); + }), + ], + ); + }, ), - ))); + DataRow( + cells: [ + const DataCell(Align( + alignment: Alignment.center, + child: Text( + 'Σ', + style: + TextStyle(fontSize: 25, fontWeight: FontWeight.bold), + ), + )), + ...widget.gameSession.playerScores.map( + (score) => DataCell( + Center( + child: Text( + '$score', + style: const TextStyle( + fontSize: 20, fontWeight: FontWeight.bold), + ), + ), + ), + ), + ], + ), + ], + ), + ), + ), + ); } } diff --git a/pubspec.yaml b/pubspec.yaml index 07b2551..817731d 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -2,7 +2,7 @@ name: cabo_counter description: "Mobile app for the card game Cabo" publish_to: 'none' -version: 0.4.7+513 +version: 0.4.7+515 environment: sdk: ^3.5.4