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 a932cf3 commit 7a3d4f9
Showing 1 changed file with 84 additions and 79 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

0 comments on commit 7a3d4f9

Please sign in to comment.