Skip to content

Commit

Permalink
fix: reuse selected platform (#551)
Browse files Browse the repository at this point in the history
Co-authored-by: Jaime <52668514+jsgalarraga@users.noreply.github.com>
  • Loading branch information
marwfair and jsgalarraga authored Jun 4, 2024
1 parent 4e2b6ac commit 93c969f
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 30 deletions.
60 changes: 30 additions & 30 deletions lib/team_selection/view/team_selection_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class _TeamSelectorLarge extends StatelessWidget {
repeat: ImageRepeat.repeat,
),
),
Align(
const Align(
child: SizedBox(
width: tileWidth * 5,
height:
Expand All @@ -113,10 +113,7 @@ class _TeamSelectorLarge extends StatelessWidget {
child: SizedBox(
width: tileWidth,
height: platformTileHeight,
child: TeamSelectionMascotPlatform(
mascot: Mascots.dash,
selected: state.index == Mascots.dash.index,
),
child: _TeamPlatform(Mascots.dash),
),
),
Positioned(
Expand All @@ -125,10 +122,7 @@ class _TeamSelectorLarge extends StatelessWidget {
child: SizedBox(
width: tileWidth,
height: platformTileHeight,
child: TeamSelectionMascotPlatform(
mascot: Mascots.sparky,
selected: state.index == Mascots.sparky.index,
),
child: _TeamPlatform(Mascots.sparky),
),
),
Positioned(
Expand All @@ -137,10 +131,7 @@ class _TeamSelectorLarge extends StatelessWidget {
child: SizedBox(
width: tileWidth,
height: platformTileHeight,
child: TeamSelectionMascotPlatform(
mascot: Mascots.android,
selected: state.index == Mascots.android.index,
),
child: _TeamPlatform(Mascots.android),
),
),
Positioned(
Expand All @@ -149,10 +140,7 @@ class _TeamSelectorLarge extends StatelessWidget {
child: SizedBox(
width: tileWidth,
height: platformTileHeight,
child: TeamSelectionMascotPlatform(
mascot: Mascots.dino,
selected: state.index == Mascots.dino.index,
),
child: _TeamPlatform(Mascots.dino),
),
),
],
Expand Down Expand Up @@ -328,18 +316,34 @@ class _TeamSelectorSmallState extends State<_TeamSelectorSmall>
width: _TeamSelectorSmall.tileWidth * 7,
child: Stack(
children: [
_SmallPlatform(Mascots.dash),
SizedBox(
width: _TeamSelectorSmall.tileWidth,
height: _TeamSelectorSmall.platformTileHeight,
child: _TeamPlatform(Mascots.dash),
),
Positioned(
left: _TeamSelectorSmall.tileWidth * 2,
child: _SmallPlatform(Mascots.sparky),
child: SizedBox(
width: _TeamSelectorSmall.tileWidth,
height: _TeamSelectorSmall.platformTileHeight,
child: _TeamPlatform(Mascots.sparky),
),
),
Positioned(
left: _TeamSelectorSmall.tileWidth * 4,
child: _SmallPlatform(Mascots.android),
child: SizedBox(
width: _TeamSelectorSmall.tileWidth,
height: _TeamSelectorSmall.platformTileHeight,
child: _TeamPlatform(Mascots.android),
),
),
Positioned(
left: _TeamSelectorSmall.tileWidth * 6,
child: _SmallPlatform(Mascots.dino),
child: SizedBox(
width: _TeamSelectorSmall.tileWidth,
height: _TeamSelectorSmall.platformTileHeight,
child: _TeamPlatform(Mascots.dino),
),
),
],
),
Expand Down Expand Up @@ -504,8 +508,8 @@ extension TeamMascot on Mascots {
}
}

class _SmallPlatform extends StatelessWidget {
const _SmallPlatform(
class _TeamPlatform extends StatelessWidget {
const _TeamPlatform(
this.mascot,
);

Expand All @@ -516,13 +520,9 @@ class _SmallPlatform extends StatelessWidget {
final index =
context.select((TeamSelectionCubit cubit) => cubit.state.index);

return SizedBox(
width: _TeamSelectorSmall.tileWidth,
height: _TeamSelectorSmall.platformTileHeight,
child: TeamSelectionMascotPlatform(
mascot: mascot,
selected: index == mascot.index,
),
return TeamSelectionMascotPlatform(
mascot: mascot,
selected: index == mascot.index,
);
}
}
Expand Down
1 change: 1 addition & 0 deletions test/helpers/pump_app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ extension PumpRoute on WidgetTester {
),
);
final mockedCrosswordRepository = _MockCrosswordRepository();
registerFallbackValue(Point(0, 0));
when(() => mockedCrosswordRepository.getRandomUncompletedSection(any()))
.thenAnswer(
(_) => Future.value(
Expand Down

0 comments on commit 93c969f

Please sign in to comment.