Skip to content

Commit

Permalink
Make the last winner box responsive (based on the screen width)
Browse files Browse the repository at this point in the history
  • Loading branch information
imaNNeo committed Nov 14, 2024
1 parent 9796eb7 commit ba1c06e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class _AnimatedLastMatchWidget extends StatefulWidget {

final double height;
final double width;
static const ratio = 126 / 61;
static const ratio = 110 / 61;

final MatchOverviewEntity? lastMatch;

Expand Down Expand Up @@ -103,7 +103,7 @@ class _AnimatedLastMatchWidgetState extends State<_AnimatedLastMatchWidget> {
'$timeAgo ago',
style: TextStyle(
color: Colors.white60,
fontSize: width * 0.07,
fontSize: width * 0.08,
),
),
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ class _MultiPlayerLobbyPageContentState extends State<MultiPlayerLobbyPage> {
Expanded(
child: PendingMatchBox(
horizontalPadding: boxHorizontalPadding,
screenSize: screenSize,
),
),
SizedBox(height: boxVerticalSpacing),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,20 @@ class PendingMatchBox extends StatelessWidget {
const PendingMatchBox({
super.key,
required this.horizontalPadding,
required this.screenSize,
});

final double horizontalPadding;
final ScreenSize screenSize;

@override
Widget build(BuildContext context) {
const lastWinnerHeight = 40.0;
final lastWinnerHeight = switch (screenSize) {
ScreenSize.extraSmall => 32.0,
ScreenSize.small => 42.0,
ScreenSize.medium => 52.0,
ScreenSize.large || ScreenSize.extraLarge => 60.0,
};
return BlocBuilder<MultiplayerCubit, MultiplayerState>(
builder: (context, state) {
return TransparentContentBox(
Expand Down Expand Up @@ -98,8 +105,8 @@ class PendingMatchBox extends StatelessWidget {
],
),
Transform.translate(
offset: const Offset(18, -lastWinnerHeight),
child: const LastMatchWinnerWidget(
offset: Offset(18, -lastWinnerHeight),
child: LastMatchWinnerWidget(
height: lastWinnerHeight,
),
)
Expand Down

0 comments on commit ba1c06e

Please sign in to comment.