Removed horizontal scrollbar and adjusted text width

This commit is contained in:
2025-08-02 17:08:11 +02:00
parent 287294526a
commit bd8d356235
2 changed files with 115 additions and 114 deletions

View File

@@ -27,32 +27,33 @@ class _PointsViewState extends State<PointsView> {
return SingleChildScrollView( return SingleChildScrollView(
scrollDirection: Axis.vertical, scrollDirection: Axis.vertical,
child: SingleChildScrollView( child: ConstrainedBox(
scrollDirection: Axis.horizontal, constraints: BoxConstraints(minWidth: constraints.maxWidth),
child: ConstrainedBox( child: Padding(
constraints: BoxConstraints(minWidth: constraints.maxWidth), padding: const EdgeInsets.symmetric(horizontal: 8),
child: Padding( child: DataTable(
padding: const EdgeInsets.symmetric(horizontal: 8), dataRowMaxHeight: 60,
child: DataTable( dataRowMinHeight: 60,
dataRowMaxHeight: 60, columnSpacing: 0,
dataRowMinHeight: 60, columns: [
columnSpacing: 20, const DataColumn(
columns: [ label: SizedBox(
const DataColumn( width: 18,
label: SizedBox( child: Text(
width: 18, '#',
child: Text( style: TextStyle(fontWeight: FontWeight.bold),
'#', textAlign: TextAlign.center,
style: TextStyle(fontWeight: FontWeight.bold),
textAlign: TextAlign.center,
),
), ),
numeric: true,
), ),
...widget.gameSession.players.map( numeric: true,
(player) => DataColumn( ),
label: SizedBox( ...widget.gameSession.players.map(
width: columnWidth, (player) => DataColumn(
label: SizedBox(
width: columnWidth,
child: Padding(
padding:
const EdgeInsets.symmetric(horizontal: 4),
child: Text( child: Text(
player, player,
style: const TextStyle( style: const TextStyle(
@@ -65,103 +66,103 @@ class _PointsViewState extends State<PointsView> {
), ),
), ),
), ),
], ),
rows: [ ],
...List<DataRow>.generate( rows: [
widget.gameSession.roundList.length, ...List<DataRow>.generate(
(roundIndex) { widget.gameSession.roundList.length,
final round = (roundIndex) {
widget.gameSession.roundList[roundIndex]; final round =
return DataRow( widget.gameSession.roundList[roundIndex];
cells: [ return DataRow(
DataCell(Align( cells: [
alignment: Alignment.center, DataCell(Align(
child: Text( alignment: Alignment.center,
'${roundIndex + 1}', child: Text(
style: const TextStyle(fontSize: 20), '${roundIndex + 1}',
), style: const TextStyle(fontSize: 20),
)), ),
...List.generate( )),
widget.gameSession.players.length, ...List.generate(
(playerIndex) { widget.gameSession.players.length,
final int score = round.scores[playerIndex]; (playerIndex) {
final int update = final int score = round.scores[playerIndex];
round.scoreUpdates[playerIndex]; final int update =
final bool saidCabo = round.scoreUpdates[playerIndex];
round.caboPlayerIndex == playerIndex; final bool saidCabo =
return DataCell( round.caboPlayerIndex == playerIndex;
Center( return DataCell(
child: Column( Center(
mainAxisAlignment: child: Column(
MainAxisAlignment.center, mainAxisAlignment:
children: [ MainAxisAlignment.center,
const SizedBox( children: [
height: 5, 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( child: Text(
padding: const EdgeInsets.symmetric( '${update >= 0 ? '+' : ''}$update',
horizontal: 6, vertical: 2), style: const TextStyle(
decoration: BoxDecoration( color: CupertinoColors.white,
color: update <= 0 fontWeight: FontWeight.bold,
? 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', const SizedBox(height: 4),
style: TextStyle( Text('$score',
decorationThickness: 1, style: TextStyle(
decoration: saidCabo decorationThickness: 1,
? TextDecoration.underline decoration: saidCabo
: TextDecoration.none, ? TextDecoration.underline
fontWeight: saidCabo : TextDecoration.none,
? FontWeight.bold fontWeight: saidCabo
: FontWeight.normal, ? 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),
), ),
), ),
), ),
], ),
), ],
], ),
), ],
), ),
), ),
)); ));

View File

@@ -2,7 +2,7 @@ name: cabo_counter
description: "Mobile app for the card game Cabo" description: "Mobile app for the card game Cabo"
publish_to: 'none' publish_to: 'none'
version: 0.5.4+616 version: 0.5.4+622
environment: environment:
sdk: ^3.5.4 sdk: ^3.5.4