Updated table width calculation and formatting
This commit is contained in:
@@ -22,23 +22,31 @@ class _PointsViewState extends State<PointsView> {
|
|||||||
previousPageTitle: AppLocalizations.of(context).back,
|
previousPageTitle: AppLocalizations.of(context).back,
|
||||||
),
|
),
|
||||||
child: SafeArea(child: LayoutBuilder(builder: (context, constraints) {
|
child: SafeArea(child: LayoutBuilder(builder: (context, constraints) {
|
||||||
final int columnCount = 1 + widget.gameSession.players.length;
|
const double roundColWidth = 35;
|
||||||
final double columnWidth = constraints.maxWidth / columnCount;
|
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(
|
return SingleChildScrollView(
|
||||||
scrollDirection: Axis.vertical,
|
scrollDirection: Axis.vertical,
|
||||||
child: ConstrainedBox(
|
child: ConstrainedBox(
|
||||||
constraints: BoxConstraints(minWidth: constraints.maxWidth),
|
constraints: BoxConstraints(maxWidth: constraints.maxWidth),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
padding: const EdgeInsets.symmetric(horizontal: tablePadding),
|
||||||
child: DataTable(
|
child: DataTable(
|
||||||
dataRowMaxHeight: 60,
|
dataRowMaxHeight: 65,
|
||||||
dataRowMinHeight: 60,
|
dataRowMinHeight: 65,
|
||||||
columnSpacing: 0,
|
columnSpacing: 0,
|
||||||
|
horizontalMargin: 0,
|
||||||
columns: [
|
columns: [
|
||||||
const DataColumn(
|
const DataColumn(
|
||||||
label: SizedBox(
|
label: SizedBox(
|
||||||
width: 18,
|
width: roundColWidth,
|
||||||
child: Text(
|
child: Text(
|
||||||
'#',
|
'#',
|
||||||
style: TextStyle(fontWeight: FontWeight.bold),
|
style: TextStyle(fontWeight: FontWeight.bold),
|
||||||
@@ -50,10 +58,10 @@ class _PointsViewState extends State<PointsView> {
|
|||||||
...widget.gameSession.players.map(
|
...widget.gameSession.players.map(
|
||||||
(player) => DataColumn(
|
(player) => DataColumn(
|
||||||
label: SizedBox(
|
label: SizedBox(
|
||||||
width: columnWidth,
|
width: playerColWidth,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding:
|
padding:
|
||||||
const EdgeInsets.symmetric(horizontal: 4),
|
const EdgeInsets.symmetric(horizontal: 8),
|
||||||
child: Text(
|
child: Text(
|
||||||
player,
|
player,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
@@ -119,16 +127,26 @@ class _PointsViewState extends State<PointsView> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 4),
|
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(
|
style: TextStyle(
|
||||||
decorationThickness: 1,
|
color: CustomTheme.white,
|
||||||
decoration: saidCabo
|
|
||||||
? TextDecoration.underline
|
|
||||||
: TextDecoration.none,
|
|
||||||
fontWeight: saidCabo
|
fontWeight: saidCabo
|
||||||
? FontWeight.bold
|
? FontWeight.bold
|
||||||
: FontWeight.normal,
|
: FontWeight.normal,
|
||||||
)),
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -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+622
|
version: 0.5.5+633
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ^3.5.4
|
sdk: ^3.5.4
|
||||||
|
|||||||
Reference in New Issue
Block a user