mirror of
https://github.com/Nioux/AideDeJeu.git
synced 2025-10-31 23:45:39 +00:00
BloC
This commit is contained in:
parent
765d65afd4
commit
25da74dfd2
4 changed files with 129 additions and 118 deletions
|
|
@ -0,0 +1,90 @@
|
|||
import 'package:aidedejeu_flutter/models/items.dart';
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
|
||||
class PlayerCharacterState extends Equatable {
|
||||
final BuildContext context;
|
||||
|
||||
final RaceItem race;
|
||||
final SubRaceItem subRace;
|
||||
final List<RaceItem> races;
|
||||
final List<SubRaceItem> subRaces;
|
||||
|
||||
final BackgroundItem background;
|
||||
final SubBackgroundItem subBackground;
|
||||
final List<BackgroundItem> backgrounds;
|
||||
final List<SubBackgroundItem> subBackgrounds;
|
||||
|
||||
PlayerCharacterState({
|
||||
this.context,
|
||||
this.race,
|
||||
this.races,
|
||||
this.subRace,
|
||||
this.subRaces,
|
||||
this.background,
|
||||
this.backgrounds,
|
||||
this.subBackground,
|
||||
this.subBackgrounds,
|
||||
});
|
||||
|
||||
PlayerCharacterState copyWith({
|
||||
BuildContext context,
|
||||
RaceItem race,
|
||||
List<RaceItem> races,
|
||||
SubRaceItem subRace,
|
||||
List<SubRaceItem> subRaces,
|
||||
BackgroundItem background,
|
||||
List<BackgroundItem> backgrounds,
|
||||
SubBackgroundItem subBackground,
|
||||
List<SubBackgroundItem> subBackgrounds,
|
||||
}) {
|
||||
return PlayerCharacterState(
|
||||
context: context ?? this.context,
|
||||
race: race ?? this.race,
|
||||
races: races ?? this.races,
|
||||
subRace: subRace ?? this.subRace,
|
||||
subRaces: subRaces ?? this.subRaces,
|
||||
background: background ?? this.background,
|
||||
backgrounds: backgrounds ?? this.backgrounds,
|
||||
subBackground: subBackground ?? this.subBackground,
|
||||
subBackgrounds: subBackgrounds ?? this.subBackgrounds,
|
||||
);
|
||||
}
|
||||
|
||||
PlayerCharacterState copyWithClean({
|
||||
BuildContext context,
|
||||
RaceItem race,
|
||||
List<RaceItem> races,
|
||||
SubRaceItem subRace,
|
||||
List<SubRaceItem> subRaces,
|
||||
BackgroundItem background,
|
||||
List<BackgroundItem> backgrounds,
|
||||
SubBackgroundItem subBackground,
|
||||
List<SubBackgroundItem> subBackgrounds,
|
||||
}) {
|
||||
return PlayerCharacterState(
|
||||
context: context ?? this.context,
|
||||
race: race ?? this.race,
|
||||
races: races ?? this.races,
|
||||
subRace: race != null ? null : subRace ?? this.subRace,
|
||||
subRaces: race != null ? subRaces : subRaces ?? this.subRaces,
|
||||
background: background ?? this.background,
|
||||
backgrounds: backgrounds ?? this.backgrounds,
|
||||
subBackground: background != null ? null : subBackground ?? this.subBackground,
|
||||
subBackgrounds: background != null ? subBackgrounds : subBackgrounds ?? this.subBackgrounds,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
List<Object> get props => [
|
||||
race,
|
||||
subRace,
|
||||
races,
|
||||
subRaces,
|
||||
background,
|
||||
subBackground,
|
||||
backgrounds,
|
||||
subBackgrounds
|
||||
];
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue