60 lines
1.5 KiB
Dart
60 lines
1.5 KiB
Dart
// import '../../../../core/constants/asset_paths.dart';
|
|
|
|
// class AvatarConfig {
|
|
// final String gender; // 'male' or 'female'
|
|
// final int variant; // 1 to 8
|
|
// final String selectedBackground;
|
|
|
|
// const AvatarConfig({
|
|
// this.gender = 'male',
|
|
// this.variant = 1,
|
|
// this.selectedBackground = 'bg_street_day',
|
|
// });
|
|
|
|
// factory AvatarConfig.fromJson(Map<String, dynamic> json) {
|
|
// return AvatarConfig(
|
|
// gender: json['gender'] ?? 'male',
|
|
// variant: json['variant'] ?? 1,
|
|
// );
|
|
// }
|
|
|
|
// Map<String, dynamic> toJson() {
|
|
// return {
|
|
// 'gender': gender,
|
|
// 'variant': variant,
|
|
// };
|
|
// }
|
|
|
|
// String get assetPath => AssetPaths.getAvatarPath(gender, variant);
|
|
// }
|
|
import '../../../../core/constants/asset_paths.dart';
|
|
|
|
class AvatarConfig {
|
|
final String gender;
|
|
final int variant;
|
|
final String selectedBackground; // NEU
|
|
|
|
const AvatarConfig({
|
|
this.gender = 'male',
|
|
this.variant = 1,
|
|
this.selectedBackground = 'bg_street_day', // Default
|
|
});
|
|
|
|
factory AvatarConfig.fromJson(Map<String, dynamic> json) {
|
|
return AvatarConfig(
|
|
gender: json['gender'] ?? 'male',
|
|
variant: json['variant'] ?? 1,
|
|
selectedBackground: json['selected_background'] ?? 'bg_street_day', // NEU
|
|
);
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
return {
|
|
'gender': gender,
|
|
'variant': variant,
|
|
'selected_background': selectedBackground, // NEU
|
|
};
|
|
}
|
|
|
|
String get assetPath => AssetPaths.getAvatarPath(gender, variant);
|
|
}
|