|
|
@ -22,14 +22,15 @@ enum CharacterType {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// {@template leaderboard_entry}
|
|
|
|
/// {@template leaderboard_entry}
|
|
|
|
/// A model representing a leaderboard entry containing a score and a username.
|
|
|
|
/// A model representing a leaderboard entry containing the player's initials,
|
|
|
|
|
|
|
|
/// score, and chosen character.
|
|
|
|
///
|
|
|
|
///
|
|
|
|
/// Stored in Firestore `leaderboard` collection.
|
|
|
|
/// Stored in Firestore `leaderboard` collection.
|
|
|
|
///
|
|
|
|
///
|
|
|
|
/// Example:
|
|
|
|
/// Example:
|
|
|
|
/// ```json
|
|
|
|
/// ```json
|
|
|
|
/// {
|
|
|
|
/// {
|
|
|
|
/// "username" : "test123",
|
|
|
|
/// "playerInitials" : "ABC",
|
|
|
|
/// "score" : 1500,
|
|
|
|
/// "score" : 1500,
|
|
|
|
/// "character" : "dash"
|
|
|
|
/// "character" : "dash"
|
|
|
|
/// }
|
|
|
|
/// }
|
|
|
@ -39,7 +40,7 @@ enum CharacterType {
|
|
|
|
class LeaderboardEntry extends Equatable {
|
|
|
|
class LeaderboardEntry extends Equatable {
|
|
|
|
/// {@macro leaderboard_entry}
|
|
|
|
/// {@macro leaderboard_entry}
|
|
|
|
const LeaderboardEntry({
|
|
|
|
const LeaderboardEntry({
|
|
|
|
required this.username,
|
|
|
|
required this.playerInitials,
|
|
|
|
required this.score,
|
|
|
|
required this.score,
|
|
|
|
required this.character,
|
|
|
|
required this.character,
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -52,11 +53,11 @@ class LeaderboardEntry extends Equatable {
|
|
|
|
/// Converts the [LeaderboardEntry] to [Map].
|
|
|
|
/// Converts the [LeaderboardEntry] to [Map].
|
|
|
|
Map<String, dynamic> toJson() => _$LeaderboardEntryToJson(this);
|
|
|
|
Map<String, dynamic> toJson() => _$LeaderboardEntryToJson(this);
|
|
|
|
|
|
|
|
|
|
|
|
/// Username for [LeaderboardEntry].
|
|
|
|
/// Player's chosen initials for [LeaderboardEntry].
|
|
|
|
///
|
|
|
|
///
|
|
|
|
/// Example: 'test123'.
|
|
|
|
/// Example: 'ABC'.
|
|
|
|
@JsonKey(name: 'username')
|
|
|
|
@JsonKey(name: 'playerInitials')
|
|
|
|
final String username;
|
|
|
|
final String playerInitials;
|
|
|
|
|
|
|
|
|
|
|
|
/// Score for [LeaderboardEntry].
|
|
|
|
/// Score for [LeaderboardEntry].
|
|
|
|
///
|
|
|
|
///
|
|
|
@ -72,11 +73,11 @@ class LeaderboardEntry extends Equatable {
|
|
|
|
|
|
|
|
|
|
|
|
/// An empty [LeaderboardEntry] object.
|
|
|
|
/// An empty [LeaderboardEntry] object.
|
|
|
|
static const empty = LeaderboardEntry(
|
|
|
|
static const empty = LeaderboardEntry(
|
|
|
|
username: '',
|
|
|
|
playerInitials: '',
|
|
|
|
score: 0,
|
|
|
|
score: 0,
|
|
|
|
character: CharacterType.dash,
|
|
|
|
character: CharacterType.dash,
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
List<Object?> get props => [username, score, character];
|
|
|
|
List<Object?> get props => [playerInitials, score, character];
|
|
|
|
}
|
|
|
|
}
|
|
|
|