Skip to content

Commit

Permalink
score board
Browse files Browse the repository at this point in the history
  • Loading branch information
cp-sidhdhi-p committed Mar 12, 2024
1 parent 7a28406 commit c9ca341
Show file tree
Hide file tree
Showing 47 changed files with 7,021 additions and 648 deletions.
2 changes: 1 addition & 1 deletion data/.flutter-plugins-dependencies

Large diffs are not rendered by default.

66 changes: 66 additions & 0 deletions data/lib/api/ball_score/ball_score_model.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
// ignore_for_file: non_constant_identifier_names

import 'package:freezed_annotation/freezed_annotation.dart';

part 'ball_score_model.freezed.dart';

part 'ball_score_model.g.dart';

@freezed
class BallScoreModel with _$BallScoreModel {
const factory BallScoreModel({
String? id,
required String inning_id,
required int over_number,
required int ball_number,
required String bowler_id,
required String batsman_id,
int? runs_scored,
ExtrasType? extras_type,
int? extras_awarded,
WicketType? wicket_type,
String? player_out_id,
String? wicket_taker_id,
required bool is_four,
required bool is_six,
required DateTime time,
}) = _BallScoreModel;

factory BallScoreModel.fromJson(Map<String, dynamic> json) => _$BallScoreModelFromJson(json);

}

@JsonEnum(valueField: "value")
enum ExtrasType {
wide(1),
noBall(2),
bye(3),
legBye(4),
penaltyRun(5);

final int value;

const ExtrasType(this.value);
}

@JsonEnum(valueField: "value")
enum WicketType {
bowled(1),
caught(2),
caughtBehind(3),
caughtAndBowled(4),
lbw(5),
stumped(6),
runOut(7),
hitWicket(8),
hitBallTwice(9),
handledBall(10),
obstructingField(11),
timedOut(12),
retired(13),
retiredHurt(14);

final int value;

const WicketType(this.value);
}
Loading

0 comments on commit c9ca341

Please sign in to comment.