Files
front-hokm/lib/feature/shop/domain/entities/avatar_character.dart
T
2026-07-10 00:56:58 +03:30

35 lines
1.2 KiB
Dart

/// یک شخصیتِ آواتار (کازمتیک تصویری). owned یعنی قابلِ انتخاب.
class AvatarCharacter {
final String id;
final String title;
final int priceCoins;
final bool vip;
final String img; // نامِ فایل: <id>.<ext> (برای ساختِ URL و انتخابِ رندرر)
final bool owned;
const AvatarCharacter({
required this.id,
required this.title,
required this.priceCoins,
required this.vip,
required this.img,
required this.owned,
});
factory AvatarCharacter.fromJson(Map<String, dynamic> j) => AvatarCharacter(
id: (j['id'] ?? '') as String,
title: (j['title'] ?? '') as String,
priceCoins: (j['price_coins'] ?? 0) as int,
vip: (j['vip'] ?? false) as bool,
img: (j['img'] ?? '') as String,
owned: (j['owned'] ?? false) as bool,
);
}
/// کاتالوگِ شخصیت‌ها + شناسه‌ی شخصیتِ انتخابیِ کاربر (خالی ⇒ آواتارِ تصادفی).
class AvatarCatalog {
final List<AvatarCharacter> avatars;
final String selected;
const AvatarCatalog({required this.avatars, required this.selected});
}