From bb43bd2d4b0691f7ead264913a6a21532b0738d8 Mon Sep 17 00:00:00 2001 From: Felix Kirchner Date: Fri, 1 Aug 2025 13:21:22 +0200 Subject: [PATCH 1/9] Build no --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 0873c95..95e9bab 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.5.4+609 +version: 0.5.4+613 environment: sdk: ^3.5.4 From 3346bfe6d972bd272654cf1afe93eb5eac0f31b1 Mon Sep 17 00:00:00 2001 From: Felix Kirchner Date: Sat, 2 Aug 2025 16:44:17 +0200 Subject: [PATCH 2/9] Updated graph padding --- lib/presentation/views/graph_view.dart | 43 +++++++++++++------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/lib/presentation/views/graph_view.dart b/lib/presentation/views/graph_view.dart index da9f8e7..d67507a 100644 --- a/lib/presentation/views/graph_view.dart +++ b/lib/presentation/views/graph_view.dart @@ -30,29 +30,28 @@ class _GraphViewState extends State { middle: Text(AppLocalizations.of(context).scoring_history), previousPageTitle: AppLocalizations.of(context).back, ), - child: Visibility( - visible: widget.gameSession.roundNumber > 1 || - widget.gameSession.isGameFinished, - replacement: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - const Center( - child: Icon(CupertinoIcons.chart_bar_alt_fill, size: 60), - ), - const SizedBox(height: 10), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 40), - child: Text( - AppLocalizations.of(context).empty_graph_text, - textAlign: TextAlign.center, - style: const TextStyle(fontSize: 16), + child: SafeArea( + child: Visibility( + visible: widget.gameSession.roundNumber > 1 || + widget.gameSession.isGameFinished, + replacement: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + const Center( + child: Icon(CupertinoIcons.chart_bar_alt_fill, size: 60), ), - ), - ], - ), - child: Padding( - padding: const EdgeInsets.fromLTRB(0, 100, 0, 0), + const SizedBox(height: 10), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 40), + child: Text( + AppLocalizations.of(context).empty_graph_text, + textAlign: TextAlign.center, + style: const TextStyle(fontSize: 16), + ), + ), + ], + ), child: SfCartesianChart( enableAxisAnimation: true, legend: const Legend( From 287294526a4d0c1ecef9f57f3d925ad256ceb69f Mon Sep 17 00:00:00 2001 From: Felix Kirchner Date: Sat, 2 Aug 2025 16:44:31 +0200 Subject: [PATCH 3/9] Implemented new point view --- lib/presentation/views/points_view.dart | 259 +++++++++++++----------- pubspec.yaml | 2 +- 2 files changed, 145 insertions(+), 116 deletions(-) diff --git a/lib/presentation/views/points_view.dart b/lib/presentation/views/points_view.dart index 1379785..64ea452 100644 --- a/lib/presentation/views/points_view.dart +++ b/lib/presentation/views/points_view.dart @@ -17,125 +17,154 @@ class _PointsViewState extends State { @override Widget build(BuildContext context) { return CupertinoPageScaffold( - navigationBar: CupertinoNavigationBar( - middle: Text(AppLocalizations.of(context).point_overview), - 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)), - ), - ], - 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 + 1}', - style: const TextStyle(fontSize: 20), - ), - )), - ...List.generate(widget.gameSession.players.length, - (playerIndex) { - final int score = round.scores[playerIndex]; - final int update = round.scoreUpdates[playerIndex]; - final bool saidCabo = - round.caboPlayerIndex == playerIndex; - return DataCell( - Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Container( - padding: const EdgeInsets.symmetric( - horizontal: 6, vertical: 2), - decoration: BoxDecoration( - color: update <= 0 - ? CustomTheme.pointLossColor - : CustomTheme.pointGainColor, - 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, - )), - ], + navigationBar: CupertinoNavigationBar( + middle: Text(AppLocalizations.of(context).point_overview), + previousPageTitle: AppLocalizations.of(context).back, + ), + child: SafeArea(child: LayoutBuilder(builder: (context, constraints) { + final int columnCount = 1 + widget.gameSession.players.length; + final double columnWidth = constraints.maxWidth / columnCount; + + return SingleChildScrollView( + scrollDirection: Axis.vertical, + child: SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: ConstrainedBox( + constraints: BoxConstraints(minWidth: constraints.maxWidth), + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 8), + child: DataTable( + dataRowMaxHeight: 60, + dataRowMinHeight: 60, + columnSpacing: 20, + columns: [ + const DataColumn( + label: SizedBox( + width: 18, + child: Text( + '#', + style: TextStyle(fontWeight: FontWeight.bold), + textAlign: TextAlign.center, ), ), - ); - }), - ], - ); - }, - ), - 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), + numeric: true, ), - ), + ...widget.gameSession.players.map( + (player) => DataColumn( + label: SizedBox( + width: columnWidth, + child: Text( + player, + style: const TextStyle( + fontWeight: FontWeight.bold), + overflow: TextOverflow.ellipsis, + softWrap: true, + maxLines: 2, + textAlign: TextAlign.center, + ), + ), + ), + ), + ], + 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 + 1}', + style: const TextStyle(fontSize: 20), + ), + )), + ...List.generate( + widget.gameSession.players.length, + (playerIndex) { + final int score = round.scores[playerIndex]; + final int update = + round.scoreUpdates[playerIndex]; + final bool saidCabo = + round.caboPlayerIndex == playerIndex; + return DataCell( + Center( + child: Column( + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + const SizedBox( + height: 5, + ), + Container( + padding: const EdgeInsets.symmetric( + horizontal: 6, vertical: 2), + decoration: BoxDecoration( + color: update <= 0 + ? CustomTheme.pointLossColor + : CustomTheme.pointGainColor, + 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( + decorationThickness: 1, + decoration: saidCabo + ? TextDecoration.underline + : TextDecoration.none, + 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 95e9bab..8d46244 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.5.4+613 +version: 0.5.4+616 environment: sdk: ^3.5.4 From bd8d3562354faf43a112ccb5305f5fc256a812ca Mon Sep 17 00:00:00 2001 From: Felix Kirchner Date: Sat, 2 Aug 2025 17:08:11 +0200 Subject: [PATCH 4/9] Removed horizontal scrollbar and adjusted text width --- lib/presentation/views/points_view.dart | 227 ++++++++++++------------ pubspec.yaml | 2 +- 2 files changed, 115 insertions(+), 114 deletions(-) diff --git a/lib/presentation/views/points_view.dart b/lib/presentation/views/points_view.dart index 64ea452..b914be6 100644 --- a/lib/presentation/views/points_view.dart +++ b/lib/presentation/views/points_view.dart @@ -27,32 +27,33 @@ class _PointsViewState extends State { return SingleChildScrollView( scrollDirection: Axis.vertical, - child: SingleChildScrollView( - scrollDirection: Axis.horizontal, - child: ConstrainedBox( - constraints: BoxConstraints(minWidth: constraints.maxWidth), - child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 8), - child: DataTable( - dataRowMaxHeight: 60, - dataRowMinHeight: 60, - columnSpacing: 20, - columns: [ - const DataColumn( - label: SizedBox( - width: 18, - child: Text( - '#', - style: TextStyle(fontWeight: FontWeight.bold), - textAlign: TextAlign.center, - ), + child: ConstrainedBox( + constraints: BoxConstraints(minWidth: constraints.maxWidth), + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 8), + child: DataTable( + dataRowMaxHeight: 60, + dataRowMinHeight: 60, + columnSpacing: 0, + columns: [ + const DataColumn( + label: SizedBox( + width: 18, + child: Text( + '#', + style: TextStyle(fontWeight: FontWeight.bold), + textAlign: TextAlign.center, ), - numeric: true, ), - ...widget.gameSession.players.map( - (player) => DataColumn( - label: SizedBox( - width: columnWidth, + numeric: true, + ), + ...widget.gameSession.players.map( + (player) => DataColumn( + label: SizedBox( + width: columnWidth, + child: Padding( + padding: + const EdgeInsets.symmetric(horizontal: 4), child: Text( player, style: const TextStyle( @@ -65,103 +66,103 @@ class _PointsViewState extends State { ), ), ), - ], - 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 + 1}', - style: const TextStyle(fontSize: 20), - ), - )), - ...List.generate( - widget.gameSession.players.length, - (playerIndex) { - final int score = round.scores[playerIndex]; - final int update = - round.scoreUpdates[playerIndex]; - final bool saidCabo = - round.caboPlayerIndex == playerIndex; - return DataCell( - Center( - child: Column( - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - const SizedBox( - height: 5, + ), + ], + 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 + 1}', + style: const TextStyle(fontSize: 20), + ), + )), + ...List.generate( + widget.gameSession.players.length, + (playerIndex) { + final int score = round.scores[playerIndex]; + final int update = + round.scoreUpdates[playerIndex]; + final bool saidCabo = + round.caboPlayerIndex == playerIndex; + return DataCell( + Center( + child: Column( + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + const SizedBox( + height: 5, + ), + Container( + padding: const EdgeInsets.symmetric( + horizontal: 6, vertical: 2), + decoration: BoxDecoration( + color: update <= 0 + ? CustomTheme.pointLossColor + : CustomTheme.pointGainColor, + borderRadius: + BorderRadius.circular(8), ), - Container( - padding: const EdgeInsets.symmetric( - horizontal: 6, vertical: 2), - decoration: BoxDecoration( - color: update <= 0 - ? CustomTheme.pointLossColor - : CustomTheme.pointGainColor, - borderRadius: - BorderRadius.circular(8), - ), - child: Text( - '${update >= 0 ? '+' : ''}$update', - style: const TextStyle( - color: CupertinoColors.white, - fontWeight: FontWeight.bold, - ), + child: Text( + '${update >= 0 ? '+' : ''}$update', + style: const TextStyle( + color: CupertinoColors.white, + fontWeight: FontWeight.bold, ), ), - const SizedBox(height: 4), - Text('$score', - style: TextStyle( - decorationThickness: 1, - decoration: saidCabo - ? TextDecoration.underline - : TextDecoration.none, - fontWeight: saidCabo - ? FontWeight.bold - : FontWeight.normal, - )), - ], - ), + ), + const SizedBox(height: 4), + Text('$score', + style: TextStyle( + decorationThickness: 1, + decoration: saidCabo + ? TextDecoration.underline + : TextDecoration.none, + 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), ), + ); + }), + ], + ); + }, + ), + 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 8d46244..2a96a6a 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.5.4+616 +version: 0.5.4+622 environment: sdk: ^3.5.4 From 1974cff35f5911806d6a2529a3d46476bc31b442 Mon Sep 17 00:00:00 2001 From: Felix Kirchner Date: Sat, 2 Aug 2025 17:57:30 +0200 Subject: [PATCH 5/9] Updated table width calculation and formatting --- lib/presentation/views/points_view.dart | 48 +++++++++++++++++-------- pubspec.yaml | 2 +- 2 files changed, 34 insertions(+), 16 deletions(-) diff --git a/lib/presentation/views/points_view.dart b/lib/presentation/views/points_view.dart index b914be6..3db61ef 100644 --- a/lib/presentation/views/points_view.dart +++ b/lib/presentation/views/points_view.dart @@ -22,23 +22,31 @@ class _PointsViewState extends State { previousPageTitle: AppLocalizations.of(context).back, ), child: SafeArea(child: LayoutBuilder(builder: (context, constraints) { - final int columnCount = 1 + widget.gameSession.players.length; - final double columnWidth = constraints.maxWidth / columnCount; + const double roundColWidth = 35; + const double tablePadding = 8; + final int playerCount = widget.gameSession.players.length; + final double playerColWidth = + (constraints.maxWidth - roundColWidth - (tablePadding)) / + playerCount; + print('Column width: $playerColWidth'); + print('Max width: ${constraints.maxWidth}'); + print('Round column width: $roundColWidth'); return SingleChildScrollView( scrollDirection: Axis.vertical, child: ConstrainedBox( - constraints: BoxConstraints(minWidth: constraints.maxWidth), + constraints: BoxConstraints(maxWidth: constraints.maxWidth), child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 8), + padding: const EdgeInsets.symmetric(horizontal: tablePadding), child: DataTable( - dataRowMaxHeight: 60, - dataRowMinHeight: 60, + dataRowMaxHeight: 65, + dataRowMinHeight: 65, columnSpacing: 0, + horizontalMargin: 0, columns: [ const DataColumn( label: SizedBox( - width: 18, + width: roundColWidth, child: Text( '#', style: TextStyle(fontWeight: FontWeight.bold), @@ -50,10 +58,10 @@ class _PointsViewState extends State { ...widget.gameSession.players.map( (player) => DataColumn( label: SizedBox( - width: columnWidth, + width: playerColWidth, child: Padding( padding: - const EdgeInsets.symmetric(horizontal: 4), + const EdgeInsets.symmetric(horizontal: 8), child: Text( player, style: const TextStyle( @@ -119,16 +127,26 @@ class _PointsViewState extends State { ), ), const SizedBox(height: 4), - Text('$score', + Container( + padding: const EdgeInsets.symmetric( + horizontal: 4, vertical: 2), + decoration: BoxDecoration( + color: saidCabo + ? const Color(0xFF505050) + : CupertinoColors.transparent, + borderRadius: + BorderRadius.circular(5), + ), + child: Text( + '$score', style: TextStyle( - decorationThickness: 1, - decoration: saidCabo - ? TextDecoration.underline - : TextDecoration.none, + color: CustomTheme.white, fontWeight: saidCabo ? FontWeight.bold : FontWeight.normal, - )), + ), + ), + ), ], ), ), diff --git a/pubspec.yaml b/pubspec.yaml index 2a96a6a..5b3cf65 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.5.4+622 +version: 0.5.5+633 environment: sdk: ^3.5.4 From 7518d006b8be73cd32c4a306695a120463199d01 Mon Sep 17 00:00:00 2001 From: Felix Kirchner Date: Sat, 2 Aug 2025 18:07:07 +0200 Subject: [PATCH 6/9] Removed prints --- lib/presentation/views/points_view.dart | 3 --- pubspec.yaml | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/presentation/views/points_view.dart b/lib/presentation/views/points_view.dart index 3db61ef..692622d 100644 --- a/lib/presentation/views/points_view.dart +++ b/lib/presentation/views/points_view.dart @@ -28,9 +28,6 @@ class _PointsViewState extends State { final double playerColWidth = (constraints.maxWidth - roundColWidth - (tablePadding)) / playerCount; - print('Column width: $playerColWidth'); - print('Max width: ${constraints.maxWidth}'); - print('Round column width: $roundColWidth'); return SingleChildScrollView( scrollDirection: Axis.vertical, diff --git a/pubspec.yaml b/pubspec.yaml index 5b3cf65..80cf6ca 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.5.5+633 +version: 0.5.5+634 environment: sdk: ^3.5.4 From 03462808c24b8805a7a5e01ba6c5fd8d3c0a3136 Mon Sep 17 00:00:00 2001 From: Felix Kirchner Date: Sat, 2 Aug 2025 18:20:12 +0200 Subject: [PATCH 7/9] Adjusted cabo player highlighting --- lib/presentation/views/points_view.dart | 84 +++++++++++++------------ pubspec.yaml | 2 +- 2 files changed, 44 insertions(+), 42 deletions(-) diff --git a/lib/presentation/views/points_view.dart b/lib/presentation/views/points_view.dart index 692622d..a850bf2 100644 --- a/lib/presentation/views/points_view.dart +++ b/lib/presentation/views/points_view.dart @@ -36,8 +36,8 @@ class _PointsViewState extends State { child: Padding( padding: const EdgeInsets.symmetric(horizontal: tablePadding), child: DataTable( - dataRowMaxHeight: 65, - dataRowMinHeight: 65, + dataRowMaxHeight: 75, + dataRowMinHeight: 75, columnSpacing: 0, horizontalMargin: 0, columns: [ @@ -96,45 +96,47 @@ class _PointsViewState extends State { round.scoreUpdates[playerIndex]; final bool saidCabo = round.caboPlayerIndex == playerIndex; - return DataCell( - Center( - child: Column( - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - const SizedBox( - height: 5, - ), - Container( - padding: const EdgeInsets.symmetric( - horizontal: 6, vertical: 2), - decoration: BoxDecoration( - color: update <= 0 - ? CustomTheme.pointLossColor - : CustomTheme.pointGainColor, - borderRadius: - BorderRadius.circular(8), + return DataCell(Center( + child: Padding( + padding: const EdgeInsets.symmetric( + vertical: 6.0), + child: Container( + width: playerColWidth * + (playerCount * + 0.2), // Adjust width based on amount of players + decoration: BoxDecoration( + color: saidCabo + ? CustomTheme.buttonBackgroundColor + : CupertinoColors.transparent, + borderRadius: BorderRadius.circular(5), + ), + child: Column( + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + const SizedBox( + height: 5, ), - child: Text( - '${update >= 0 ? '+' : ''}$update', - style: const TextStyle( - color: CupertinoColors.white, - fontWeight: FontWeight.bold, + Container( + padding: const EdgeInsets.symmetric( + horizontal: 6, vertical: 2), + decoration: BoxDecoration( + color: update <= 0 + ? CustomTheme.pointLossColor + : CustomTheme.pointGainColor, + borderRadius: + BorderRadius.circular(6), + ), + child: Text( + '${update >= 0 ? '+' : ''}$update', + style: const TextStyle( + color: CupertinoColors.white, + fontWeight: FontWeight.bold, + ), ), ), - ), - const SizedBox(height: 4), - Container( - padding: const EdgeInsets.symmetric( - horizontal: 4, vertical: 2), - decoration: BoxDecoration( - color: saidCabo - ? const Color(0xFF505050) - : CupertinoColors.transparent, - borderRadius: - BorderRadius.circular(5), - ), - child: Text( + const SizedBox(height: 4), + Text( '$score', style: TextStyle( color: CustomTheme.white, @@ -143,11 +145,11 @@ class _PointsViewState extends State { : FontWeight.normal, ), ), - ), - ], + ], + ), ), ), - ); + )); }), ], ); diff --git a/pubspec.yaml b/pubspec.yaml index 80cf6ca..58f0816 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.5.5+634 +version: 0.5.5+636 environment: sdk: ^3.5.4 From e265a671ffcd9775d6eeaf92852a9c6f2ed0ddab Mon Sep 17 00:00:00 2001 From: Felix Kirchner Date: Sat, 2 Aug 2025 18:57:18 +0200 Subject: [PATCH 8/9] Added sticky header to table --- lib/presentation/views/points_view.dart | 276 +++++++++++++++--------- pubspec.yaml | 2 +- 2 files changed, 172 insertions(+), 106 deletions(-) diff --git a/lib/presentation/views/points_view.dart b/lib/presentation/views/points_view.dart index a850bf2..2927d94 100644 --- a/lib/presentation/views/points_view.dart +++ b/lib/presentation/views/points_view.dart @@ -29,15 +29,15 @@ class _PointsViewState extends State { (constraints.maxWidth - roundColWidth - (tablePadding)) / playerCount; - return SingleChildScrollView( - scrollDirection: Axis.vertical, - child: ConstrainedBox( + return Column( + children: [ + ConstrainedBox( constraints: BoxConstraints(maxWidth: constraints.maxWidth), child: Padding( padding: const EdgeInsets.symmetric(horizontal: tablePadding), child: DataTable( - dataRowMaxHeight: 75, - dataRowMinHeight: 75, + dataRowMaxHeight: 0, + dataRowMinHeight: 0, columnSpacing: 0, horizontalMargin: 0, columns: [ @@ -73,116 +73,182 @@ class _PointsViewState extends State { ), ), ], - rows: [ - ...List.generate( - widget.gameSession.roundList.length, - (roundIndex) { - final round = - widget.gameSession.roundList[roundIndex]; - return DataRow( - cells: [ - DataCell(Align( - alignment: Alignment.center, + rows: const [], + ), + ), + ), + Expanded( + child: SingleChildScrollView( + scrollDirection: Axis.vertical, + child: ConstrainedBox( + constraints: + BoxConstraints(maxWidth: constraints.maxWidth), + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: tablePadding), + child: DataTable( + dataRowMaxHeight: 75, + dataRowMinHeight: 75, + columnSpacing: 0, + horizontalMargin: 0, + headingRowHeight: 0, + columns: [ + const DataColumn( + label: SizedBox( + width: roundColWidth, child: Text( - '${roundIndex + 1}', - style: const TextStyle(fontSize: 20), + '#', + style: TextStyle(fontWeight: FontWeight.bold), + textAlign: TextAlign.center, ), - )), - ...List.generate( - widget.gameSession.players.length, - (playerIndex) { - final int score = round.scores[playerIndex]; - final int update = - round.scoreUpdates[playerIndex]; - final bool saidCabo = - round.caboPlayerIndex == playerIndex; - return DataCell(Center( + ), + numeric: true, + ), + ...widget.gameSession.players.map( + (player) => DataColumn( + label: SizedBox( + width: playerColWidth, child: Padding( padding: const EdgeInsets.symmetric( - vertical: 6.0), - child: Container( - width: playerColWidth * - (playerCount * - 0.2), // Adjust width based on amount of players - decoration: BoxDecoration( - color: saidCabo - ? CustomTheme.buttonBackgroundColor - : CupertinoColors.transparent, - borderRadius: BorderRadius.circular(5), - ), - child: Column( - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - const SizedBox( - height: 5, - ), - Container( - padding: const EdgeInsets.symmetric( - horizontal: 6, vertical: 2), - decoration: BoxDecoration( - color: update <= 0 - ? CustomTheme.pointLossColor - : CustomTheme.pointGainColor, - borderRadius: - BorderRadius.circular(6), - ), - child: Text( - '${update >= 0 ? '+' : ''}$update', - style: const TextStyle( - color: CupertinoColors.white, - fontWeight: FontWeight.bold, - ), - ), - ), - const SizedBox(height: 4), - Text( - '$score', - style: TextStyle( - color: CustomTheme.white, - fontWeight: saidCabo - ? FontWeight.bold - : FontWeight.normal, - ), - ), - ], - ), + horizontal: 8), + child: Text( + player, + style: const TextStyle( + fontWeight: FontWeight.bold), + overflow: TextOverflow.ellipsis, + softWrap: true, + maxLines: 2, + textAlign: TextAlign.center, ), ), - )); - }), - ], - ); - }, - ), - 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), ), ), ), - ), - ], + ], + 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 + 1}', + style: const TextStyle(fontSize: 20), + ), + )), + ...List.generate( + widget.gameSession.players.length, + (playerIndex) { + final int score = + round.scores[playerIndex]; + final int update = + round.scoreUpdates[playerIndex]; + final bool saidCabo = + round.caboPlayerIndex == playerIndex; + return DataCell(Center( + child: Padding( + padding: const EdgeInsets.symmetric( + vertical: 6.0), + child: Container( + width: playerColWidth * + (playerCount * + 0.2), // Adjust width based on amount of players + decoration: BoxDecoration( + color: saidCabo + ? CustomTheme + .buttonBackgroundColor + : CupertinoColors.transparent, + borderRadius: + BorderRadius.circular(5), + ), + child: Column( + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + const SizedBox( + height: 5, + ), + Container( + padding: const EdgeInsets + .symmetric( + horizontal: 6, + vertical: 2), + decoration: BoxDecoration( + color: update <= 0 + ? CustomTheme + .pointLossColor + : CustomTheme + .pointGainColor, + borderRadius: + BorderRadius.circular( + 6), + ), + child: Text( + '${update >= 0 ? '+' : ''}$update', + style: const TextStyle( + color: + CupertinoColors.white, + fontWeight: + FontWeight.bold, + ), + ), + ), + const SizedBox(height: 4), + Text( + '$score', + style: TextStyle( + color: CustomTheme.white, + 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 58f0816..f59ec44 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.5.5+636 +version: 0.5.5+639 environment: sdk: ^3.5.4 From 231c0442448412bd4b1d9a7e84eafde198de6779 Mon Sep 17 00:00:00 2001 From: Felix Kirchner Date: Mon, 4 Aug 2025 19:36:44 +0200 Subject: [PATCH 9/9] Added named constant --- lib/presentation/views/points_view.dart | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/presentation/views/points_view.dart b/lib/presentation/views/points_view.dart index 2927d94..161d72e 100644 --- a/lib/presentation/views/points_view.dart +++ b/lib/presentation/views/points_view.dart @@ -22,6 +22,7 @@ class _PointsViewState extends State { previousPageTitle: AppLocalizations.of(context).back, ), child: SafeArea(child: LayoutBuilder(builder: (context, constraints) { + const double caboFieldWidthFactor = 0.2; const double roundColWidth = 35; const double tablePadding = 8; final int playerCount = widget.gameSession.players.length; @@ -156,7 +157,7 @@ class _PointsViewState extends State { child: Container( width: playerColWidth * (playerCount * - 0.2), // Adjust width based on amount of players + caboFieldWidthFactor), // Adjust width based on amount of players decoration: BoxDecoration( color: saidCabo ? CustomTheme