diff --git a/aidedejeu_flutter/.vscode/launch.json b/aidedejeu_flutter/.vscode/launch.json new file mode 100644 index 00000000..1e07dc68 --- /dev/null +++ b/aidedejeu_flutter/.vscode/launch.json @@ -0,0 +1,13 @@ +{ + // Utilisez IntelliSense pour en savoir plus sur les attributs possibles. + // Pointez pour afficher la description des attributs existants. + // Pour plus d'informations, visitez : https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "aidedejeu_flutter", + "request": "launch", + "type": "dart" + } + ] +} \ No newline at end of file diff --git a/aidedejeu_flutter/lib/blocs/player_character/player_character_bloc.dart b/aidedejeu_flutter/lib/blocs/player_character/player_character_bloc.dart index f692a6e0..211c3f7b 100644 --- a/aidedejeu_flutter/lib/blocs/player_character/player_character_bloc.dart +++ b/aidedejeu_flutter/lib/blocs/player_character/player_character_bloc.dart @@ -6,6 +6,7 @@ import 'package:bloc/bloc.dart'; class PlayerCharacterBloc extends Bloc { + PlayerCharacterBloc() : super(null) {} BaseDB _db = SqfliteDB.instance; @@ -28,35 +29,40 @@ class PlayerCharacterBloc } else if (event is LoadEvent) { yield* _mapLoadEventToState(event); } - } - Stream _mapRaceEventToState( - RaceEvent event) async* { + + Stream _mapRaceEventToState(RaceEvent event) async* { var subRaces = await _db.loadSubRaces(event.item); yield state.copyWithClean(race: event.item, subRaces: subRaces); } + Stream _mapSubRaceEventToState( SubRaceEvent event) async* { yield state.copyWith(subRace: event.item); } + Stream _mapOriginEventToState( OriginEvent event) async* { yield state.copyWith(origin: event.item); } + Stream _mapBackgroundEventToState( BackgroundEvent event) async* { var subBackgrounds = await _db.loadSubBackgrounds(event.item); - yield state.copyWithClean(background: event.item,subBackgrounds: subBackgrounds); + yield state.copyWithClean( + background: event.item, subBackgrounds: subBackgrounds); } + Stream _mapSubBackgroundEventToState( SubBackgroundEvent event) async* { yield state.copyWith(subBackground: event.item); } - Stream _mapLoadEventToState( - LoadEvent event) async* { + + Stream _mapLoadEventToState(LoadEvent event) async* { var races = await _db.loadRaces(); var origins = await _db.loadOrigins(); var backgrounds = await _db.loadBackgrounds(); - yield state.copyWith(races: races, origins: origins, backgrounds: backgrounds); // state; + yield state.copyWith( + races: races, origins: origins, backgrounds: backgrounds); // state; } }