Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix overflow for tablets #1196

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
3 changes: 3 additions & 0 deletions lib/src/view/analysis/analysis_layout.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ typedef BoardBuilder = Widget Function(
BuildContext context,
double boardSize,
BorderRadius? boardRadius,
Orientation orientation,
);

typedef EngineGaugeBuilder = Widget Function(
Expand Down Expand Up @@ -177,6 +178,7 @@ class AnalysisLayout extends StatelessWidget {
context,
boardSize,
isTablet ? tabletBoardRadius : null,
Orientation.landscape,
),
if (engineGaugeBuilder != null) ...[
const SizedBox(width: 4.0),
Expand Down Expand Up @@ -259,6 +261,7 @@ class AnalysisLayout extends StatelessWidget {
context,
boardSize,
isTablet ? tabletBoardRadius : null,
Orientation.portrait,
),
),
Expanded(
Expand Down
3 changes: 2 additions & 1 deletion lib/src/view/analysis/analysis_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,8 @@ class _Body extends ConsumerWidget {

return AnalysisLayout(
tabController: controller,
boardBuilder: (context, boardSize, borderRadius) => AnalysisBoard(
boardBuilder: (context, boardSize, borderRadius, orientation) =>
AnalysisBoard(
options,
boardSize,
borderRadius: borderRadius,
Expand Down
15 changes: 12 additions & 3 deletions lib/src/view/broadcast/broadcast_game_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,13 @@ class _Body extends ConsumerWidget {
return DefaultTabController(
length: 1,
child: AnalysisLayout(
boardBuilder: (context, boardSize, borderRadius) =>
boardBuilder: (context, boardSize, borderRadius, orientation) =>
_BroadcastBoardWithHeaders(
roundId,
gameId,
boardSize,
borderRadius,
orientation,
),
engineGaugeBuilder: isLocalEvaluationEnabled && showEvaluationGauge
? (context, orientation) {
Expand Down Expand Up @@ -150,12 +151,14 @@ class _BroadcastBoardWithHeaders extends ConsumerWidget {
final BroadcastGameId gameId;
final double size;
final BorderRadius? borderRadius;
final Orientation orientation;

const _BroadcastBoardWithHeaders(
this.roundId,
this.gameId,
this.size,
this.borderRadius,
this.orientation,
);

@override
Expand All @@ -172,7 +175,8 @@ class _BroadcastBoardWithHeaders extends ConsumerWidget {
bottomRight: Radius.zero,
),
),
_BroadcastBoard(roundId, gameId, size, borderRadius != null),
_BroadcastBoard(
roundId, gameId, size, borderRadius != null, orientation),
_PlayerWidget(
roundId: roundId,
gameId: gameId,
Expand All @@ -194,12 +198,14 @@ class _BroadcastBoard extends ConsumerStatefulWidget {
this.gameId,
this.boardSize,
this.hasShadow,
this.orientation,
);

final BroadcastRoundId roundId;
final BroadcastGameId gameId;
final double boardSize;
final bool hasShadow;
final Orientation orientation;

@override
ConsumerState<_BroadcastBoard> createState() => _BroadcastBoardState();
Expand Down Expand Up @@ -238,7 +244,10 @@ class _BroadcastBoardState extends ConsumerState<_BroadcastBoard> {
: ISet();

return Chessboard(
size: widget.boardSize,
size: switch (widget.orientation) {
Orientation.portrait => widget.boardSize,
Orientation.landscape => widget.boardSize - 2 * 30,
},
fen: broadcastAnalysisState.position.fen,
lastMove: broadcastAnalysisState.lastMove as NormalMove?,
orientation: broadcastAnalysisState.pov,
Expand Down
6 changes: 4 additions & 2 deletions lib/src/view/study/study_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,8 @@ class _Body extends ConsumerWidget {
return DefaultTabController(
length: 1,
child: AnalysisLayout(
boardBuilder: (context, boardSize, borderRadius) => SizedBox.square(
boardBuilder: (context, boardSize, borderRadius, orientation) =>
SizedBox.square(
dimension: boardSize,
child: Center(
child: Text(
Expand Down Expand Up @@ -249,7 +250,8 @@ class _Body extends ConsumerWidget {
return DefaultTabController(
length: 1,
child: AnalysisLayout(
boardBuilder: (context, boardSize, borderRadius) => _StudyBoard(
boardBuilder: (context, boardSize, borderRadius, orientation) =>
_StudyBoard(
id: id,
boardSize: boardSize,
borderRadius: borderRadius,
Expand Down
Loading