Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add match setting in sub collection #116

Merged
merged 4 commits into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
238 changes: 199 additions & 39 deletions data/lib/api/ball_score/ball_score_model.freezed.dart

Large diffs are not rendered by default.

21 changes: 17 additions & 4 deletions data/lib/api/innings/inning_model.freezed.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,12 @@ mixin _$InningModel {
int get total_wickets => throw _privateConstructorUsedError;
InningStatus? get innings_status => throw _privateConstructorUsedError;

/// Serializes this InningModel to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true)

/// Create a copy of InningModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$InningModelCopyWith<InningModel> get copyWith =>
throw _privateConstructorUsedError;
}
Expand Down Expand Up @@ -62,6 +66,8 @@ class _$InningModelCopyWithImpl<$Res, $Val extends InningModel>
// ignore: unused_field
final $Res Function($Val) _then;

/// Create a copy of InningModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Expand Down Expand Up @@ -138,6 +144,8 @@ class __$$InningModelImplCopyWithImpl<$Res>
_$InningModelImpl _value, $Res Function(_$InningModelImpl) _then)
: super(_value, _then);

/// Create a copy of InningModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Expand Down Expand Up @@ -248,12 +256,14 @@ class _$InningModelImpl implements _InningModel {
other.innings_status == innings_status));
}

@JsonKey(ignore: true)
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType, id, match_id, team_id, overs,
index, total_runs, total_wickets, innings_status);

@JsonKey(ignore: true)
/// Create a copy of InningModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$InningModelImplCopyWith<_$InningModelImpl> get copyWith =>
Expand Down Expand Up @@ -297,8 +307,11 @@ abstract class _InningModel implements InningModel {
int get total_wickets;
@override
InningStatus? get innings_status;

/// Create a copy of InningModel
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(ignore: true)
@JsonKey(includeFromJson: false, includeToJson: false)
_$$InningModelImplCopyWith<_$InningModelImpl> get copyWith =>
throw _privateConstructorUsedError;
}
21 changes: 20 additions & 1 deletion data/lib/api/match/match_model.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
// ignore_for_file: non_constant_identifier_names

import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:freezed_annotation/freezed_annotation.dart';

import '../../converter/timestamp_json_converter.dart';
import '../../extensions/double_extensions.dart';
import '../team/team_model.dart';
import '../user/user_models.dart';
import 'package:freezed_annotation/freezed_annotation.dart';

part 'match_model.freezed.dart';

Expand Down Expand Up @@ -61,6 +62,24 @@ class MatchModel with _$MatchModel {
MatchModel.fromJson(snapshot.data()!);
}

@freezed
class MatchSetting with _$MatchSetting {
const factory MatchSetting({
@Default(true) bool continue_with_injured_player,
@Default(true) bool show_wagon_wheel_for_less_run,
@Default(true) bool show_wagon_wheel_for_dot_ball,
}) = _MatchSetting;

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

factory MatchSetting.fromFireStore(
DocumentSnapshot<Map<String, dynamic>> snapshot,
SnapshotOptions? options,
) =>
MatchSetting.fromJson(snapshot.data()!);
}

@freezed
class MatchTeamModel with _$MatchTeamModel {
@JsonSerializable(anyMap: true, explicitToJson: true)
Expand Down
Loading
Loading