Added details and sum row

This commit is contained in:
2025-07-19 00:05:44 +02:00
parent 5b418817b2
commit 0d9c8a99cd
2 changed files with 116 additions and 91 deletions

View File

@@ -17,101 +17,126 @@ class _PointOverviewViewState extends State<PointOverviewView> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return CupertinoPageScaffold( return CupertinoPageScaffold(
resizeToAvoidBottomInset: true, resizeToAvoidBottomInset: true,
navigationBar: CupertinoNavigationBar( navigationBar: CupertinoNavigationBar(
middle: const Text('Punkte-Übersicht'), middle: const Text('Punkte-Übersicht'),
previousPageTitle: AppLocalizations.of(context).back, previousPageTitle: AppLocalizations.of(context).back,
), ),
child: SingleChildScrollView( child: SingleChildScrollView(
padding: const EdgeInsets.fromLTRB(0, 100, 0, 0), padding: const EdgeInsets.fromLTRB(0, 100, 0, 0),
child: Padding( child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 8.0), padding: const EdgeInsets.symmetric(horizontal: 8.0),
child: DataTable( child: DataTable(
dataRowMinHeight: 60, dataRowMinHeight: 60,
dataRowMaxHeight: 60, dataRowMaxHeight: 60,
dividerThickness: 0.5, dividerThickness: 0.5,
columnSpacing: 20, columnSpacing: 20,
columns: [ columns: [
const DataColumn( const DataColumn(
numeric: true, numeric: true,
headingRowAlignment: MainAxisAlignment.center, headingRowAlignment: MainAxisAlignment.center,
label: Text( label: Text(
'#', '#',
style: TextStyle(fontWeight: FontWeight.bold), 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)),
), ),
], columnWidth: IntrinsicColumnWidth(flex: 0.5)),
rows: List<DataRow>.generate( ...widget.gameSession.players.map(
widget.gameSession.roundList.length, (player) => DataColumn(
(roundIndex) { label: FittedBox(
final round = widget.gameSession.roundList[roundIndex]; fit: BoxFit.fill,
return DataRow( child: Text(
cells: [ player,
DataCell(Align( style: const TextStyle(fontWeight: FontWeight.bold),
alignment: Alignment.center,
child: Text(
'$roundIndex',
style: const TextStyle(fontSize: 20),
),
)), )),
...List.generate(widget.gameSession.players.length, headingRowAlignment: MainAxisAlignment.center,
(playerIndex) { columnWidth: const IntrinsicColumnWidth(flex: 1)),
final score = round.scores[playerIndex]; ),
final update = round.scoreUpdates[playerIndex]; ],
final saidCabo = round.caboPlayerIndex == playerIndex rows: [
? true ...List<DataRow>.generate(
: false; widget.gameSession.roundList.length,
return DataCell( (roundIndex) {
Center( final round = widget.gameSession.roundList[roundIndex];
child: Column( return DataRow(
mainAxisAlignment: MainAxisAlignment.center, cells: [
children: [ DataCell(Align(
Container( alignment: Alignment.center,
padding: const EdgeInsets.symmetric( child: Text(
horizontal: 6, vertical: 2), '$roundIndex',
decoration: BoxDecoration( style: const TextStyle(fontSize: 20),
color: update <= 0 ),
? CustomTheme.primaryColor )),
: CupertinoColors.destructiveRed, ...List.generate(widget.gameSession.players.length,
borderRadius: BorderRadius.circular(8), (playerIndex) {
), final score = round.scores[playerIndex];
child: Text( final update = round.scoreUpdates[playerIndex];
'${update >= 0 ? '+' : '-'}$update', final saidCabo =
style: const TextStyle( round.caboPlayerIndex == playerIndex ? true : false;
color: CupertinoColors.white, return DataCell(
fontWeight: FontWeight.bold, 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', const SizedBox(height: 4),
style: TextStyle( Text('$score',
fontWeight: saidCabo style: TextStyle(
? 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),
),
),
),
),
],
),
],
),
),
),
);
} }
} }

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.4.7+513 version: 0.4.7+515
environment: environment:
sdk: ^3.5.4 sdk: ^3.5.4