Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 4 additions & 20 deletions lib/src/view/broadcast/broadcast_player_results_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import 'package:lichess_mobile/src/view/broadcast/broadcast_player_widget.dart';
import 'package:lichess_mobile/src/widgets/network_image.dart';
import 'package:lichess_mobile/src/widgets/platform.dart';
import 'package:lichess_mobile/src/widgets/progression_widget.dart';
import 'package:lichess_mobile/src/widgets/side_indicator.dart';
import 'package:lichess_mobile/src/widgets/stat_card.dart';

final broadcastTournamentIdProvider = FutureProvider.autoDispose
Expand Down Expand Up @@ -495,33 +496,16 @@ class _GameResultListTile extends StatelessWidget {
)
: null,
trailing: SizedBox(
width: showTCIcon ? 72 : 60,
width: showTCIcon ? 75 : 60,
child: Row(
mainAxisSize: .min,
mainAxisAlignment: .center,
children: [
SizedBox(
width: 30,
child: Center(
child: Container(
width: 15,
height: 15,
decoration: BoxDecoration(
border:
(Theme.of(context).brightness == .light && color == .white ||
Theme.of(context).brightness == .dark && color == .black)
? Border.all(width: 2.0, color: ColorScheme.of(context).outline)
: null,
shape: .circle,
color: switch (color) {
.white => Colors.white.withValues(alpha: 0.9),
.black => Colors.black.withValues(alpha: 0.9),
},
),
),
),
child: Center(child: SideIndicator(side: color, size: 15)),
),
if (showTCIcon) SizedBox(width: 12, child: Icon(fideTC.icon, size: 15)),
if (showTCIcon) Icon(fideTC.icon, size: 15),
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unrelated change, but I don't think we should wrap the Icon with Size 15 in a SizedBox with lesser size, so I simply removed it as I don't see a reason for it.

SizedBox(
width: 30,
child: Column(
Expand Down
3 changes: 2 additions & 1 deletion lib/src/view/tournament/tournament_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import 'package:lichess_mobile/src/widgets/feedback.dart';
import 'package:lichess_mobile/src/widgets/misc.dart';
import 'package:lichess_mobile/src/widgets/network_image.dart';
import 'package:lichess_mobile/src/widgets/platform.dart';
import 'package:lichess_mobile/src/widgets/side_indicator.dart';
import 'package:lichess_mobile/src/widgets/user.dart';
import 'package:path_provider/path_provider.dart' show getTemporaryDirectory;
import 'package:share_plus/share_plus.dart';
Expand Down Expand Up @@ -1492,7 +1493,7 @@ class _PairingTile extends ConsumerWidget {
padding: EdgeInsets.only(right: 8.0),
child: Icon(LichessIcons.body_cut, size: 20),
),
Icon(pairing.color == Side.white ? Icons.circle_outlined : Icons.circle, size: 20),
SideIndicator(side: pairing.color, size: 20),
SizedBox(
width: 24,
height: 24,
Expand Down
18 changes: 18 additions & 0 deletions lib/src/widgets/side_indicator.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import 'package:dartchess/dartchess.dart';
import 'package:flutter/material.dart';

//Widget to indicate the side of the player based on the current theme.
class SideIndicator extends StatelessWidget {
const SideIndicator({super.key, required this.side, required this.size});

final Side side;
final double size;

@override
Widget build(BuildContext context) {
final isLight = Theme.of(context).brightness == Brightness.light;
return isLight
? Icon(side == .white ? Icons.circle_outlined : Icons.circle, size: size)
: Icon(side == .white ? Icons.circle : Icons.circle_outlined, size: size);
}
}