From 1974cff35f5911806d6a2529a3d46476bc31b442 Mon Sep 17 00:00:00 2001 From: Felix Kirchner Date: Sat, 2 Aug 2025 17:57:30 +0200 Subject: [PATCH] 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