feat: add characters
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
import '../../../../core/config.dart';
|
||||
|
||||
/// یک فرشِ ایرانی که بهجای میزِ بازی استفاده میشود. تصویر از backend میآید.
|
||||
/// یک فرشِ ایرانی که بهجای میزِ بازی استفاده میشود. تصویر (URL کامل) از backend میآید.
|
||||
class Carpet {
|
||||
final String id;
|
||||
final String title;
|
||||
final int priceCoins;
|
||||
final bool vip; // برای VIP رایگان
|
||||
final String img; // URL کاملِ تصویر (از سرور)؛ خالی برای classic
|
||||
final bool owned;
|
||||
|
||||
const Carpet({
|
||||
@@ -13,19 +12,19 @@ class Carpet {
|
||||
required this.title,
|
||||
required this.priceCoins,
|
||||
required this.vip,
|
||||
required this.img,
|
||||
required this.owned,
|
||||
});
|
||||
|
||||
/// 'classic' یعنی میزِ ترسیمیِ پیشفرض (بدون تصویر).
|
||||
bool get isClassic => id == 'classic';
|
||||
|
||||
String get imageUrl => '${AppConfig.baseUrl}/carpets/$id.jpg';
|
||||
|
||||
factory Carpet.fromJson(Map<String, dynamic> j) => Carpet(
|
||||
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,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user