feat: refactor code
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
/// نوع میز (از catalog.table_tiers در GET /api/shop).
|
||||
class TableTier {
|
||||
final String id;
|
||||
final String title;
|
||||
final int hands;
|
||||
final int entry;
|
||||
final int prize;
|
||||
final int xp;
|
||||
final int trophy;
|
||||
|
||||
const TableTier({
|
||||
required this.id,
|
||||
required this.title,
|
||||
required this.hands,
|
||||
required this.entry,
|
||||
required this.prize,
|
||||
required this.xp,
|
||||
required this.trophy,
|
||||
});
|
||||
|
||||
factory TableTier.fromJson(Map<String, dynamic> j) => TableTier(
|
||||
id: j['id'] as String,
|
||||
title: j['title'] as String,
|
||||
hands: (j['hands'] ?? 0) as int,
|
||||
entry: (j['entry'] ?? 0) as int,
|
||||
prize: (j['prize'] ?? 0) as int,
|
||||
xp: (j['xp'] ?? 0) as int,
|
||||
trophy: (j['trophy'] ?? 0) as int,
|
||||
);
|
||||
}
|
||||
|
||||
/// اطلاعات سهمیهی میزهای خصوصی (GET /api/tables/info).
|
||||
class TablesInfo {
|
||||
final int remaining;
|
||||
final bool unlimited;
|
||||
const TablesInfo(this.remaining, this.unlimited);
|
||||
|
||||
factory TablesInfo.fromJson(Map<String, dynamic> j) => TablesInfo(
|
||||
(j['remaining'] ?? 0) as int,
|
||||
(j['unlimited'] ?? false) as bool,
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user