Skip to content

Comments

Use BroadcastPlayerWidget where possible#2602

Merged
veloce merged 2 commits intolichess-org:mainfrom
HaonRekcef:use-broadcast-player-widget
Feb 3, 2026
Merged

Use BroadcastPlayerWidget where possible#2602
veloce merged 2 commits intolichess-org:mainfrom
HaonRekcef:use-broadcast-player-widget

Conversation

@HaonRekcef
Copy link
Collaborator

Use BroadcastPlayerWidget in more places and scale the federation image and the title with the fontSize.

Copilot AI review requested due to automatic review settings February 1, 2026 15:18
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Expands usage of BroadcastPlayerWidget across broadcast-related UI and updates it so federation flags and player titles can scale with the surrounding text size.

Changes:

  • Replaced duplicated “title + name” row rendering with BroadcastPlayerWidget in the players list and game result tiles.
  • Updated BroadcastPlayerWidget to size the federation flag and title text based on fontSize.
  • Minor style refactors (e.g., enum dot-shorthand for ellipsis).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
lib/src/view/broadcast/broadcast_players_tab.dart Uses BroadcastPlayerWidget in BroadcastPlayerRow instead of hand-built title/name UI.
lib/src/view/broadcast/broadcast_player_widget.dart Scales federation flag and title with font size; adjusts text overflow/style usage.
lib/src/view/broadcast/broadcast_player_results_screen.dart Uses BroadcastPlayerWidget for opponent title rendering in game result tiles.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +355 to +357
Expanded(
child: BroadcastPlayerWidget(player: player, showRating: false, showFederation: false),
),
Copy link

Copilot AI Feb 1, 2026

Choose a reason for hiding this comment

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

BroadcastPlayerRow now renders the name/title via BroadcastPlayerWidget, but the earlier destructuring still binds title and name (and they are no longer used in this widget). With the repo’s strict linting this can surface as an unused-local warning/failure. Prefer destructuring only the fields you actually use here (e.g. keep federation/rating for the subtitle) or rename unused bindings to _.

Copilot uses AI. Check for mistakes.
Flexible(child: Text(name ?? '', overflow: TextOverflow.ellipsis)),
],
),
title: BroadcastPlayerWidget(player: opponent, showFederation: false, showRating: false),
Copy link

Copilot AI Feb 1, 2026

Choose a reason for hiding this comment

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

_GameResultListTile no longer uses the locally destructured title/name/rating after switching the title: to BroadcastPlayerWidget, so the destructuring final BroadcastPlayer(:federation, :title, :name, :rating) = opponent; is now partially unused. Please destructure only the needed fields (e.g. federation) to avoid unused-local warnings under the project’s strict analyzer settings.

Copilot uses AI. Check for mistakes.
Comment on lines 26 to 29
Image.asset(
'assets/images/fide-fed/$federation.png',
height: (textStyle?.fontSize ?? 14) - 2,
),
Copy link

Copilot AI Feb 1, 2026

Choose a reason for hiding this comment

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

The federation image height is currently derived from textStyle?.fontSize ?? 14, which ignores the ambient DefaultTextStyle when textStyle is null. This means the flag won’t actually scale with surrounding text size in call sites that rely on DefaultTextStyle.merge (e.g. broadcast_boards_tab.dart). Consider deriving the font size from the effective text style (textStyle ?? DefaultTextStyle.of(context).style) and using that for the image height.

Copilot uses AI. Check for mistakes.
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like a good comment @HaonRekcef

Have you tested how it renders when there is no textStyle?

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh my bad you actually added that.

@veloce veloce merged commit c89246a into lichess-org:main Feb 3, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants