Revert to 4bd2f97
This commit is contained in:
@@ -8,13 +8,13 @@ class Game {
|
||||
final String name;
|
||||
final Ruleset ruleset;
|
||||
final String description;
|
||||
final GameColor color;
|
||||
final AppColor color;
|
||||
final String icon;
|
||||
|
||||
Game({
|
||||
required this.name,
|
||||
required this.ruleset,
|
||||
this.color = GameColor.orange,
|
||||
this.color = AppColor.orange,
|
||||
this.description = '',
|
||||
this.icon = '',
|
||||
String? id,
|
||||
@@ -33,7 +33,7 @@ class Game {
|
||||
String? name,
|
||||
Ruleset? ruleset,
|
||||
String? description,
|
||||
GameColor? color,
|
||||
AppColor? color,
|
||||
String? icon,
|
||||
}) {
|
||||
return Game(
|
||||
@@ -73,7 +73,7 @@ class Game {
|
||||
orElse: () => Ruleset.singleWinner,
|
||||
),
|
||||
description = json['description'],
|
||||
color = GameColor.values.firstWhere((e) => e.name == json['color']),
|
||||
color = AppColor.values.firstWhere((e) => e.name == json['color']),
|
||||
icon = json['icon'];
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
|
||||
@@ -5,17 +5,17 @@ import 'package:uuid/uuid.dart';
|
||||
|
||||
class Group {
|
||||
final String id;
|
||||
final String name;
|
||||
final String description;
|
||||
final DateTime createdAt;
|
||||
final String name;
|
||||
final List<Player> members;
|
||||
final String description;
|
||||
|
||||
Group({
|
||||
required this.name,
|
||||
required this.members,
|
||||
String? id,
|
||||
DateTime? createdAt,
|
||||
required this.name,
|
||||
String? description,
|
||||
required this.members,
|
||||
}) : id = id ?? const Uuid().v4(),
|
||||
createdAt = createdAt ?? clock.now(),
|
||||
description = description ?? '';
|
||||
|
||||
@@ -107,7 +107,7 @@ class Match {
|
||||
name: '',
|
||||
ruleset: Ruleset.singleWinner,
|
||||
description: '',
|
||||
color: GameColor.blue,
|
||||
color: AppColor.blue,
|
||||
icon: '',
|
||||
),
|
||||
group = null,
|
||||
|
||||
48
lib/data/models/statistic.dart
Normal file
48
lib/data/models/statistic.dart
Normal file
@@ -0,0 +1,48 @@
|
||||
import 'package:tallee/core/enums.dart';
|
||||
import 'package:tallee/data/models/game.dart';
|
||||
import 'package:tallee/data/models/group.dart';
|
||||
import 'package:uuid/uuid.dart';
|
||||
|
||||
class Statistic {
|
||||
final String id;
|
||||
final StatisticType type;
|
||||
final List<StatisticScope> scopes;
|
||||
final Timeframe? timeframe;
|
||||
final List<Group>? selectedGroups;
|
||||
final List<Game>? selectedGames;
|
||||
final int displayCount;
|
||||
|
||||
Statistic({
|
||||
required this.type,
|
||||
required this.scopes,
|
||||
this.timeframe,
|
||||
this.selectedGroups,
|
||||
this.selectedGames,
|
||||
this.displayCount = 5,
|
||||
String? id,
|
||||
}) : id = id ?? const Uuid().v4();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'Statistic(id: $id, type: $type, scopes: $scopes, timeframe: $timeframe, selectedGroups: $selectedGroups, selectedGames: $selectedGames)';
|
||||
}
|
||||
|
||||
Statistic copyWith({
|
||||
StatisticType? type,
|
||||
List<StatisticScope>? scopes,
|
||||
Timeframe? timeframe,
|
||||
List<Group>? selectedGroups,
|
||||
List<Game>? selectedGames,
|
||||
int? displayCount,
|
||||
}) {
|
||||
return Statistic(
|
||||
id: id,
|
||||
type: type ?? this.type,
|
||||
scopes: scopes ?? this.scopes,
|
||||
timeframe: timeframe ?? this.timeframe,
|
||||
selectedGroups: selectedGroups ?? this.selectedGroups,
|
||||
selectedGames: selectedGames ?? this.selectedGames,
|
||||
displayCount: displayCount ?? this.displayCount,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user