Visual improvements on table
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
import 'package:cabo_counter/core/custom_theme.dart';
|
||||||
import 'package:cabo_counter/data/game_session.dart';
|
import 'package:cabo_counter/data/game_session.dart';
|
||||||
import 'package:cabo_counter/l10n/generated/app_localizations.dart';
|
import 'package:cabo_counter/l10n/generated/app_localizations.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
@@ -24,16 +25,32 @@ class _PointOverviewViewState extends State<PointOverviewView> {
|
|||||||
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: 5.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(label: Text('#')),
|
const DataColumn(
|
||||||
|
numeric: true,
|
||||||
|
headingRowAlignment: MainAxisAlignment.center,
|
||||||
|
label: Text(
|
||||||
|
'#',
|
||||||
|
style: TextStyle(fontWeight: FontWeight.bold),
|
||||||
|
),
|
||||||
|
columnWidth: IntrinsicColumnWidth(flex: 0.5)),
|
||||||
...widget.gameSession.players.map(
|
...widget.gameSession.players.map(
|
||||||
(player) => DataColumn(label: Text(player)),
|
(player) => DataColumn(
|
||||||
|
label: FittedBox(
|
||||||
|
fit: BoxFit.fill,
|
||||||
|
child: Text(
|
||||||
|
player,
|
||||||
|
style:
|
||||||
|
const TextStyle(fontWeight: FontWeight.bold),
|
||||||
|
)),
|
||||||
|
headingRowAlignment: MainAxisAlignment.center,
|
||||||
|
columnWidth: const IntrinsicColumnWidth(flex: 1)),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
rows: List<DataRow>.generate(
|
rows: List<DataRow>.generate(
|
||||||
@@ -46,40 +63,47 @@ class _PointOverviewViewState extends State<PointOverviewView> {
|
|||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
child: Text(
|
child: Text(
|
||||||
'$roundIndex',
|
'$roundIndex',
|
||||||
style: const TextStyle(
|
style: const TextStyle(fontSize: 20),
|
||||||
fontWeight: FontWeight.bold, fontSize: 20),
|
|
||||||
),
|
),
|
||||||
)),
|
)),
|
||||||
...List.generate(widget.gameSession.players.length,
|
...List.generate(widget.gameSession.players.length,
|
||||||
(playerIndex) {
|
(playerIndex) {
|
||||||
final score = round.scores[playerIndex];
|
final score = round.scores[playerIndex];
|
||||||
final update = round.scoreUpdates[playerIndex];
|
final update = round.scoreUpdates[playerIndex];
|
||||||
|
final saidCabo = round.caboPlayerIndex == playerIndex
|
||||||
|
? true
|
||||||
|
: false;
|
||||||
return DataCell(
|
return DataCell(
|
||||||
Column(
|
Center(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
child: Column(
|
||||||
children: [
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
Container(
|
children: [
|
||||||
padding: const EdgeInsets.symmetric(
|
Container(
|
||||||
horizontal: 6, vertical: 2),
|
padding: const EdgeInsets.symmetric(
|
||||||
decoration: BoxDecoration(
|
horizontal: 6, vertical: 2),
|
||||||
color: update <= 0
|
decoration: BoxDecoration(
|
||||||
? Colors.green[200]
|
|
||||||
: Colors.red[200],
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
),
|
|
||||||
child: Text(
|
|
||||||
'${update >= 0 ? '+' : '-'}$update',
|
|
||||||
style: TextStyle(
|
|
||||||
color: update <= 0
|
color: update <= 0
|
||||||
? Colors.green[900]
|
? CustomTheme.primaryColor
|
||||||
: Colors.red[900],
|
: CupertinoColors.destructiveRed,
|
||||||
fontWeight: FontWeight.bold,
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
'${update >= 0 ? '+' : '-'}$update',
|
||||||
|
style: const TextStyle(
|
||||||
|
color: CupertinoColors.white,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
const SizedBox(height: 4),
|
||||||
const SizedBox(height: 4),
|
Text('$score',
|
||||||
Text('$score'),
|
style: TextStyle(
|
||||||
],
|
fontWeight: saidCabo
|
||||||
|
? FontWeight.bold
|
||||||
|
: FontWeight.normal,
|
||||||
|
)),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
|
|||||||
Reference in New Issue
Block a user