import 'package:bloc/bloc.dart'; import 'package:equatable/equatable.dart'; part 'start_game_event.dart'; part 'start_game_state.dart'; /// {@template start_game_bloc} /// Bloc that manages the app flow before the game starts. /// {@endtemplate} class StartGameBloc extends Bloc { /// {@macro start_game_bloc} StartGameBloc() : super(const StartGameState.initial()) { on(_onPlayTapped); on(_onReplayTapped); on(_onCharacterSelected); on(_onHowToPlayFinished); } void _onPlayTapped( PlayTapped event, Emitter emit, ) { emit( state.copyWith( status: StartGameStatus.selectCharacter, ), ); } void _onReplayTapped( ReplayTapped event, Emitter emit, ) { emit( state.copyWith( status: StartGameStatus.selectCharacter, ), ); } void _onCharacterSelected( CharacterSelected event, Emitter emit, ) { emit( state.copyWith( status: StartGameStatus.howToPlay, ), ); } void _onHowToPlayFinished( HowToPlayFinished event, Emitter emit, ) { emit( state.copyWith( status: StartGameStatus.play, ), ); } }