mirror of
https://github.com/Nioux/AideDeJeu.git
synced 2025-10-29 14:35:45 +00:00
Maj flutter
This commit is contained in:
parent
5d04060727
commit
5ec93124ec
2 changed files with 26 additions and 7 deletions
13
aidedejeu_flutter/.vscode/launch.json
vendored
Normal file
13
aidedejeu_flutter/.vscode/launch.json
vendored
Normal 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"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
@ -6,6 +6,7 @@ import 'package:bloc/bloc.dart';
|
||||||
|
|
||||||
class PlayerCharacterBloc
|
class PlayerCharacterBloc
|
||||||
extends Bloc<PlayerCharacterEvent, PlayerCharacterState> {
|
extends Bloc<PlayerCharacterEvent, PlayerCharacterState> {
|
||||||
|
PlayerCharacterBloc() : super(null) {}
|
||||||
|
|
||||||
BaseDB _db = SqfliteDB.instance;
|
BaseDB _db = SqfliteDB.instance;
|
||||||
|
|
||||||
|
|
@ -28,35 +29,40 @@ class PlayerCharacterBloc
|
||||||
} else if (event is LoadEvent) {
|
} else if (event is LoadEvent) {
|
||||||
yield* _mapLoadEventToState(event);
|
yield* _mapLoadEventToState(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Stream<PlayerCharacterState> _mapRaceEventToState(
|
|
||||||
RaceEvent event) async* {
|
Stream<PlayerCharacterState> _mapRaceEventToState(RaceEvent event) async* {
|
||||||
var subRaces = await _db.loadSubRaces(event.item);
|
var subRaces = await _db.loadSubRaces(event.item);
|
||||||
yield state.copyWithClean(race: event.item, subRaces: subRaces);
|
yield state.copyWithClean(race: event.item, subRaces: subRaces);
|
||||||
}
|
}
|
||||||
|
|
||||||
Stream<PlayerCharacterState> _mapSubRaceEventToState(
|
Stream<PlayerCharacterState> _mapSubRaceEventToState(
|
||||||
SubRaceEvent event) async* {
|
SubRaceEvent event) async* {
|
||||||
yield state.copyWith(subRace: event.item);
|
yield state.copyWith(subRace: event.item);
|
||||||
}
|
}
|
||||||
|
|
||||||
Stream<PlayerCharacterState> _mapOriginEventToState(
|
Stream<PlayerCharacterState> _mapOriginEventToState(
|
||||||
OriginEvent event) async* {
|
OriginEvent event) async* {
|
||||||
yield state.copyWith(origin: event.item);
|
yield state.copyWith(origin: event.item);
|
||||||
}
|
}
|
||||||
|
|
||||||
Stream<PlayerCharacterState> _mapBackgroundEventToState(
|
Stream<PlayerCharacterState> _mapBackgroundEventToState(
|
||||||
BackgroundEvent event) async* {
|
BackgroundEvent event) async* {
|
||||||
var subBackgrounds = await _db.loadSubBackgrounds(event.item);
|
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(
|
Stream<PlayerCharacterState> _mapSubBackgroundEventToState(
|
||||||
SubBackgroundEvent event) async* {
|
SubBackgroundEvent event) async* {
|
||||||
yield state.copyWith(subBackground: event.item);
|
yield state.copyWith(subBackground: event.item);
|
||||||
}
|
}
|
||||||
Stream<PlayerCharacterState> _mapLoadEventToState(
|
|
||||||
LoadEvent event) async* {
|
Stream<PlayerCharacterState> _mapLoadEventToState(LoadEvent event) async* {
|
||||||
var races = await _db.loadRaces();
|
var races = await _db.loadRaces();
|
||||||
var origins = await _db.loadOrigins();
|
var origins = await _db.loadOrigins();
|
||||||
var backgrounds = await _db.loadBackgrounds();
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue