Implemented new point view
This commit is contained in:
@@ -17,125 +17,154 @@ class _PointsViewState extends State<PointsView> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return CupertinoPageScaffold(
|
return CupertinoPageScaffold(
|
||||||
navigationBar: CupertinoNavigationBar(
|
navigationBar: CupertinoNavigationBar(
|
||||||
middle: Text(AppLocalizations.of(context).point_overview),
|
middle: Text(AppLocalizations.of(context).point_overview),
|
||||||
previousPageTitle: AppLocalizations.of(context).back,
|
previousPageTitle: AppLocalizations.of(context).back,
|
||||||
),
|
),
|
||||||
child: SingleChildScrollView(
|
child: SafeArea(child: LayoutBuilder(builder: (context, constraints) {
|
||||||
padding: const EdgeInsets.fromLTRB(0, 100, 0, 0),
|
final int columnCount = 1 + widget.gameSession.players.length;
|
||||||
child: Padding(
|
final double columnWidth = constraints.maxWidth / columnCount;
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 8.0),
|
|
||||||
child: DataTable(
|
return SingleChildScrollView(
|
||||||
dataRowMinHeight: 60,
|
scrollDirection: Axis.vertical,
|
||||||
dataRowMaxHeight: 60,
|
child: SingleChildScrollView(
|
||||||
dividerThickness: 0.5,
|
scrollDirection: Axis.horizontal,
|
||||||
columnSpacing: 20,
|
child: ConstrainedBox(
|
||||||
columns: [
|
constraints: BoxConstraints(minWidth: constraints.maxWidth),
|
||||||
const DataColumn(
|
child: Padding(
|
||||||
numeric: true,
|
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||||||
headingRowAlignment: MainAxisAlignment.center,
|
child: DataTable(
|
||||||
label: Text(
|
dataRowMaxHeight: 60,
|
||||||
'#',
|
dataRowMinHeight: 60,
|
||||||
style: TextStyle(fontWeight: FontWeight.bold),
|
columnSpacing: 20,
|
||||||
),
|
columns: [
|
||||||
columnWidth: IntrinsicColumnWidth(flex: 0.5)),
|
const DataColumn(
|
||||||
...widget.gameSession.players.map(
|
label: SizedBox(
|
||||||
(player) => DataColumn(
|
width: 18,
|
||||||
label: FittedBox(
|
child: Text(
|
||||||
fit: BoxFit.fill,
|
'#',
|
||||||
child: Text(
|
style: TextStyle(fontWeight: FontWeight.bold),
|
||||||
player,
|
textAlign: TextAlign.center,
|
||||||
style: const TextStyle(fontWeight: FontWeight.bold),
|
|
||||||
)),
|
|
||||||
headingRowAlignment: MainAxisAlignment.center,
|
|
||||||
columnWidth: const IntrinsicColumnWidth(flex: 1)),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
rows: [
|
|
||||||
...List<DataRow>.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,
|
|
||||||
)),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
numeric: true,
|
||||||
}),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
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),
|
|
||||||
),
|
),
|
||||||
),
|
...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<DataRow>.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),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
));
|
||||||
],
|
})));
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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+613
|
version: 0.5.4+616
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ^3.5.4
|
sdk: ^3.5.4
|
||||||
|
|||||||
Reference in New Issue
Block a user