Skip to content

Commit

Permalink
Improve analysis summary tablet layout
Browse files Browse the repository at this point in the history
  • Loading branch information
ZTL-UwU committed Jan 11, 2024
1 parent 9334707 commit e2c54d8
Show file tree
Hide file tree
Showing 2 changed files with 98 additions and 109 deletions.
163 changes: 84 additions & 79 deletions lib/src/view/analysis/analysis_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -841,89 +841,94 @@ class ServerAnalysisSummary extends ConsumerWidget {
children: [
AcplChart(options),
if (serverAnalysis != null)
Padding(
padding: const EdgeInsets.all(16.0),
child: Table(
defaultVerticalAlignment: TableCellVerticalAlignment.middle,
columnWidths: const {
0: FlexColumnWidth(1),
1: FlexColumnWidth(1),
2: FlexColumnWidth(1),
},
children: [
TableRow(
Center(
child: SizedBox(
width: math.min(MediaQuery.of(context).size.width, 500),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: Table(
defaultVerticalAlignment: TableCellVerticalAlignment.middle,
columnWidths: const {
0: FlexColumnWidth(1),
1: FlexColumnWidth(1),
2: FlexColumnWidth(1),
},
children: [
_SummaryPlayerName(Side.white, pgnHeaders),
const SizedBox(width: 0),
_SummaryPlayerName(Side.black, pgnHeaders),
],
),
for (final item in [
(
serverAnalysis.white.inaccuracies.toString(),
'Inaccuracies',
serverAnalysis.black.inaccuracies.toString()
),
(
serverAnalysis.white.inaccuracies.toString(),
'Mistakes',
serverAnalysis.black.inaccuracies.toString()
),
(
serverAnalysis.white.inaccuracies.toString(),
'Blunders',
serverAnalysis.black.inaccuracies.toString()
),
if (serverAnalysis.white.acpl != null &&
serverAnalysis.black.acpl != null)
(
serverAnalysis.white.acpl.toString(),
context.l10n.averageCentipawnLoss,
serverAnalysis.black.acpl.toString(),
TableRow(
children: [
_SummaryPlayerName(Side.white, pgnHeaders),
const SizedBox(width: 0),
_SummaryPlayerName(Side.black, pgnHeaders),
],
),
])
TableRow(
children: [
_SummaryNumber(item.$1),
Text(
item.$2,
softWrap: true,
for (final item in [
(
serverAnalysis.white.inaccuracies.toString(),
'Inaccuracies',
serverAnalysis.black.inaccuracies.toString()
),
_SummaryNumber(item.$3),
],
),
if (serverAnalysis.white.accuracy != null &&
serverAnalysis.black.accuracy != null)
TableRow(
children: [
_SummaryNumber('${serverAnalysis.white.accuracy}%'),
Center(
child: Row(
children: [
Text(
context.l10n.accuracy,
softWrap: true,
),
const SizedBox(width: 8.0),
PlatformIconButton(
icon: Icons.info_outline_rounded,
semanticsLabel: 'More info',
padding: EdgeInsets.zero,
onTap: () async {
await launchUrl(
Uri.parse(
'https://lichess.org/page/accuracy',
),
);
},
),
],
(
serverAnalysis.white.inaccuracies.toString(),
'Mistakes',
serverAnalysis.black.inaccuracies.toString()
),
(
serverAnalysis.white.inaccuracies.toString(),
'Blunders',
serverAnalysis.black.inaccuracies.toString()
),
if (serverAnalysis.white.acpl != null &&
serverAnalysis.black.acpl != null)
(
serverAnalysis.white.acpl.toString(),
context.l10n.averageCentipawnLoss,
serverAnalysis.black.acpl.toString(),
),
])
TableRow(
children: [
_SummaryNumber(item.$1),
Text(
item.$2,
softWrap: true,
),
_SummaryNumber(item.$3),
],
),
_SummaryNumber('${serverAnalysis.black.accuracy}%'),
],
),
],
if (serverAnalysis.white.accuracy != null &&
serverAnalysis.black.accuracy != null)
TableRow(
children: [
_SummaryNumber('${serverAnalysis.white.accuracy}%'),
Center(
child: Row(
children: [
Text(
context.l10n.accuracy,
softWrap: true,
),
const SizedBox(width: 8.0),
PlatformIconButton(
icon: Icons.info_outline_rounded,
semanticsLabel: 'More info',
padding: EdgeInsets.zero,
onTap: () async {
await launchUrl(
Uri.parse(
'https://lichess.org/page/accuracy',
),
);
},
),
],
),
),
_SummaryNumber('${serverAnalysis.black.accuracy}%'),
],
),
],
),
),
),
),
],
Expand Down Expand Up @@ -967,7 +972,7 @@ class _SummaryPlayerName extends StatelessWidget {
child: Center(
heightFactor: 1.4,
child: Padding(
padding: const EdgeInsets.only(right: 8, bottom: 8),
padding: const EdgeInsets.only(bottom: 4),
child: Wrap(
crossAxisAlignment: WrapCrossAlignment.center,
spacing: 2.0,
Expand Down
44 changes: 14 additions & 30 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ packages:
dependency: transitive
description:
name: _fe_analyzer_shared
sha256: "36a321c3d2cbe01cbcb3540a87b8843846e0206df3e691fa7b23e19e78de6d49"
sha256: eb376e9acf6938204f90eb3b1f00b578640d3188b4c8a8ec054f9f479af8d051
url: "https://pub.dev"
source: hosted
version: "65.0.0"
version: "64.0.0"
_flutterfire_internals:
dependency: transitive
description:
Expand All @@ -21,10 +21,10 @@ packages:
dependency: transitive
description:
name: analyzer
sha256: dfe03b90ec022450e22513b5e5ca1f01c0c01de9c3fba2f7fd233cb57a6b9a07
sha256: "69f54f967773f6c26c7dcb13e93d7ccee8b17a641689da39e878d5cf13b06893"
url: "https://pub.dev"
source: hosted
version: "6.3.0"
version: "6.2.0"
analyzer_plugin:
dependency: transitive
description:
Expand Down Expand Up @@ -765,22 +765,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "6.7.1"
leak_tracker:
dependency: transitive
description:
name: leak_tracker
sha256: "04be76c4a4bb50f14904e64749237e541e7c7bcf7ec0b196907322ab5d2fc739"
url: "https://pub.dev"
source: hosted
version: "9.0.16"
leak_tracker_testing:
dependency: transitive
description:
name: leak_tracker_testing
sha256: b06739349ec2477e943055aea30172c5c7000225f79dad4702e2ec0eda79a6ff
url: "https://pub.dev"
source: hosted
version: "1.0.5"
lint:
dependency: "direct dev"
description:
Expand Down Expand Up @@ -809,18 +793,18 @@ packages:
dependency: transitive
description:
name: material_color_utilities
sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a"
sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41"
url: "https://pub.dev"
source: hosted
version: "0.8.0"
version: "0.5.0"
meta:
dependency: "direct main"
description:
name: meta
sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04
sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e
url: "https://pub.dev"
source: hosted
version: "1.11.0"
version: "1.10.0"
mime:
dependency: transitive
description:
Expand Down Expand Up @@ -1416,10 +1400,10 @@ packages:
dependency: transitive
description:
name: uuid
sha256: bb55f38968b9427ce5dcdb8aaaa41049282195e0cfa4cf48593572fa3d1f36bc
sha256: "8c951c9cb6504b2aa6b3666e6de504032d9baec24bf4cbabd3eea9edd73d4d77"
url: "https://pub.dev"
source: hosted
version: "4.3.1"
version: "4.3.2"
vector_math:
dependency: transitive
description:
Expand Down Expand Up @@ -1472,18 +1456,18 @@ packages:
dependency: transitive
description:
name: web
sha256: edc8a9573dd8c5a83a183dae1af2b6fd4131377404706ca4e5420474784906fa
sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152
url: "https://pub.dev"
source: hosted
version: "0.4.0"
version: "0.3.0"
web_socket_channel:
dependency: "direct main"
description:
name: web_socket_channel
sha256: "045ec2137c27bf1a32e6ffa0e734d532a6677bf9016a0d1a406c54e499ff945b"
sha256: d88238e5eac9a42bb43ca4e721edba3c08c6354d4a53063afaa568516217621b
url: "https://pub.dev"
source: hosted
version: "2.4.1"
version: "2.4.0"
win32:
dependency: transitive
description:
Expand Down

0 comments on commit e2c54d8

Please sign in to comment.