From af65374aa6bede0218ff0fa2af084a703b1f0ca1 Mon Sep 17 00:00:00 2001 From: arturplaczek Date: Wed, 13 Apr 2022 15:14:03 +0200 Subject: [PATCH] fix: apply code review --- lib/game/bloc/start_game_bloc.dart | 18 ++++++++--------- lib/game/bloc/start_game_event.dart | 31 ++++++++++++++++++++++++----- lib/game/bloc/start_game_state.dart | 4 +--- 3 files changed, 36 insertions(+), 17 deletions(-) diff --git a/lib/game/bloc/start_game_bloc.dart b/lib/game/bloc/start_game_bloc.dart index 3f04e33f..3541b60c 100644 --- a/lib/game/bloc/start_game_bloc.dart +++ b/lib/game/bloc/start_game_bloc.dart @@ -21,10 +21,10 @@ class StartGameBloc extends Bloc { final PinballGame _game; - Future _onSelectCharacter( + void _onSelectCharacter( SelectCharacter event, - Emitter emit, - ) async { + Emitter emit, + ) { _game.gameFlowController.start(); emit( @@ -34,10 +34,10 @@ class StartGameBloc extends Bloc { ); } - Future _onHowToPlay( + void _onHowToPlay( HowToPlay event, - Emitter emit, - ) async { + Emitter emit, + ) { emit( state.copyWith( status: StartGameStatus.howToPlay, @@ -45,10 +45,10 @@ class StartGameBloc extends Bloc { ); } - Future _onPlay( + void _onPlay( Play event, - Emitter emit, - ) async { + Emitter emit, + ) { emit( state.copyWith( status: StartGameStatus.play, diff --git a/lib/game/bloc/start_game_event.dart b/lib/game/bloc/start_game_event.dart index e3da0afe..590aa8a9 100644 --- a/lib/game/bloc/start_game_event.dart +++ b/lib/game/bloc/start_game_event.dart @@ -6,16 +6,37 @@ part of 'start_game_bloc.dart'; abstract class StartGameEvent extends Equatable { /// {@macro start_game_event} const StartGameEvent(); +} + +/// {@template select_character} +/// Select character event. +/// {@endtemplate} +class SelectCharacter extends StartGameEvent { + /// {@macro select_character} + const SelectCharacter(); @override List get props => []; } -/// Select character event. -class SelectCharacter extends StartGameEvent {} - +/// {@template how_to_play} /// How to play event. -class HowToPlay extends StartGameEvent {} +/// {@endtemplate} +class HowToPlay extends StartGameEvent { + /// {@macro how_to_play} + const HowToPlay(); + + @override + List get props => []; +} +/// {@template play} /// Play event. -class Play extends StartGameEvent {} +/// {@endtemplate} +class Play extends StartGameEvent { + /// {@macro play} + const Play(); + + @override + List get props => []; +} diff --git a/lib/game/bloc/start_game_state.dart b/lib/game/bloc/start_game_state.dart index 72402e81..9cff3ac2 100644 --- a/lib/game/bloc/start_game_state.dart +++ b/lib/game/bloc/start_game_state.dart @@ -40,7 +40,5 @@ class StartGameState extends Equatable { } @override - List get props => [ - status, - ]; + List get props => [status]; }