-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: update team selection UI (#310)
* feat: update the TeamSelectionPage UI * fix: assets gen file * update mobile layout and assets * update gradient animation * add dash android android assets * refactor: add animations and correct layouts * rename name field * remove unused assets * add team classes * update tests * set images prefix in test * set images prefix in more tests * add team tests and remove failing zoom tests * remove unused imports
- Loading branch information
Showing
42 changed files
with
822 additions
and
248 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
/// {@template mascots} | ||
/// Google Mascots enum | ||
/// Google Mascots enum. | ||
/// {@endtemplate} | ||
enum Mascots { | ||
/// Flutter Dash mascot | ||
/// Flutter Dash mascot. | ||
dash, | ||
|
||
/// Firebase Sparky mascot | ||
/// Firebase Sparky mascot. | ||
sparky, | ||
|
||
/// Chrome Dino mascot | ||
dino, | ||
|
||
/// Android mascot | ||
/// Android mascot. | ||
android, | ||
|
||
/// Chrome Dino mascot. | ||
dino; | ||
} |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,29 @@ | ||
import 'package:bloc/bloc.dart'; | ||
import 'package:equatable/equatable.dart'; | ||
import 'package:flame/cache.dart'; | ||
import 'package:flame/flame.dart'; | ||
import 'package:game_domain/game_domain.dart'; | ||
import 'package:io_crossword/team_selection/team_selection.dart'; | ||
|
||
class TeamSelectionCubit extends Cubit<int> { | ||
TeamSelectionCubit() : super(0); | ||
part 'team_selection_state.dart'; | ||
|
||
class TeamSelectionCubit extends Cubit<TeamSelectionState> { | ||
TeamSelectionCubit() : super(const TeamSelectionState()); | ||
|
||
Future<void> load() async { | ||
emit(state.copyWith(status: TeamSelectionStatus.loading)); | ||
Flame.images = Images(prefix: ''); | ||
await Flame.images.loadAll([ | ||
Mascots.dash.teamMascot.idleAnimation.keyName, | ||
Mascots.android.teamMascot.platformAnimation.keyName, | ||
]); | ||
|
||
if (!isClosed) { | ||
emit(state.copyWith(status: TeamSelectionStatus.loadingComplete)); | ||
} | ||
} | ||
|
||
void selectTeam(int teamIndex) { | ||
emit(teamIndex); | ||
emit(state.copyWith(index: teamIndex)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
part of 'team_selection_cubit.dart'; | ||
|
||
enum TeamSelectionStatus { | ||
loading, | ||
|
||
loadingComplete, | ||
} | ||
|
||
class TeamSelectionState extends Equatable { | ||
const TeamSelectionState({ | ||
this.status = TeamSelectionStatus.loading, | ||
this.index = 0, | ||
}); | ||
|
||
final TeamSelectionStatus status; | ||
|
||
final int index; | ||
|
||
TeamSelectionState copyWith({ | ||
TeamSelectionStatus? status, | ||
int? index, | ||
}) { | ||
return TeamSelectionState( | ||
status: status ?? this.status, | ||
index: index ?? this.index, | ||
); | ||
} | ||
|
||
@override | ||
List<Object> get props => [ | ||
status, | ||
index, | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import 'package:io_crossword/assets/assets.gen.dart'; | ||
import 'package:io_crossword/team_selection/teams/team.dart'; | ||
|
||
class AndroidTeam extends Team { | ||
const AndroidTeam(); | ||
|
||
@override | ||
String get name => 'Android'; | ||
|
||
@override | ||
AssetGenImage get idleAnimation => Assets.anim.dashIdle; | ||
|
||
@override | ||
AssetGenImage get platformAnimation => Assets.anim.androidPlatform; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import 'package:io_crossword/assets/assets.gen.dart'; | ||
import 'package:io_crossword/team_selection/teams/team.dart'; | ||
|
||
class DashTeam extends Team { | ||
const DashTeam(); | ||
|
||
@override | ||
String get name => 'Dash'; | ||
|
||
@override | ||
AssetGenImage get idleAnimation => Assets.anim.dashIdle; | ||
|
||
@override | ||
AssetGenImage get platformAnimation => Assets.anim.androidPlatform; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import 'package:io_crossword/assets/assets.gen.dart'; | ||
import 'package:io_crossword/team_selection/teams/team.dart'; | ||
|
||
class DinoTeam extends Team { | ||
const DinoTeam(); | ||
|
||
@override | ||
String get name => 'Dino'; | ||
|
||
@override | ||
AssetGenImage get idleAnimation => Assets.anim.dashIdle; | ||
|
||
@override | ||
AssetGenImage get platformAnimation => Assets.anim.androidPlatform; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import 'package:io_crossword/assets/assets.gen.dart'; | ||
import 'package:io_crossword/team_selection/teams/team.dart'; | ||
|
||
class SparkyTeam extends Team { | ||
const SparkyTeam(); | ||
|
||
@override | ||
String get name => 'Sparky'; | ||
|
||
@override | ||
AssetGenImage get idleAnimation => Assets.anim.dashIdle; | ||
|
||
@override | ||
AssetGenImage get platformAnimation => Assets.anim.androidPlatform; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import 'package:equatable/equatable.dart'; | ||
import 'package:io_crossword/assets/assets.dart'; | ||
|
||
abstract class Team extends Equatable { | ||
const Team(); | ||
|
||
String get name; | ||
|
||
AssetGenImage get idleAnimation; | ||
|
||
AssetGenImage get platformAnimation; | ||
|
||
@override | ||
List<Object> get props => [ | ||
name, | ||
idleAnimation, | ||
platformAnimation, | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export 'android_team.dart'; | ||
export 'dash_team.dart'; | ||
export 'dino_team.dart'; | ||
export 'sparky_team.dart'; | ||
export 'team.dart'; |
Oops, something went wrong.