1
0
Fork 0
mirror of https://github.com/Nioux/AideDeJeu.git synced 2025-10-28 22:15:37 +00:00

Maj flutter

This commit is contained in:
Yan Maniez 2020-09-27 18:31:25 +02:00
parent 5d04060727
commit 5ec93124ec
2 changed files with 26 additions and 7 deletions

13
aidedejeu_flutter/.vscode/launch.json vendored Normal file
View file

@ -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"
}
]
}

View file

@ -6,6 +6,7 @@ import 'package:bloc/bloc.dart';
class PlayerCharacterBloc
extends Bloc<PlayerCharacterEvent, PlayerCharacterState> {
PlayerCharacterBloc() : super(null) {}
BaseDB _db = SqfliteDB.instance;
@ -28,35 +29,40 @@ class PlayerCharacterBloc
} else if (event is LoadEvent) {
yield* _mapLoadEventToState(event);
}
}
Stream<PlayerCharacterState> _mapRaceEventToState(
RaceEvent event) async* {
Stream<PlayerCharacterState> _mapRaceEventToState(RaceEvent event) async* {
var subRaces = await _db.loadSubRaces(event.item);
yield state.copyWithClean(race: event.item, subRaces: subRaces);
}
Stream<PlayerCharacterState> _mapSubRaceEventToState(
SubRaceEvent event) async* {
yield state.copyWith(subRace: event.item);
}
Stream<PlayerCharacterState> _mapOriginEventToState(
OriginEvent event) async* {
yield state.copyWith(origin: event.item);
}
Stream<PlayerCharacterState> _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<PlayerCharacterState> _mapSubBackgroundEventToState(
SubBackgroundEvent event) async* {
yield state.copyWith(subBackground: event.item);
}
Stream<PlayerCharacterState> _mapLoadEventToState(
LoadEvent event) async* {
Stream<PlayerCharacterState> _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;
}
}