diff --git a/.github/workflows/ios_deploy.yml b/.github/workflows/ios_deploy.yml index bf1b4298..61bf8293 100644 --- a/.github/workflows/ios_deploy.yml +++ b/.github/workflows/ios_deploy.yml @@ -31,7 +31,6 @@ jobs: - name: Set up Flutter uses: subosito/flutter-action@v2 with: - flutter-version: '3.22.2' channel: 'stable' cache: true diff --git a/data/.flutter-plugins b/data/.flutter-plugins index c8f414da..cea14754 100644 --- a/data/.flutter-plugins +++ b/data/.flutter-plugins @@ -8,7 +8,7 @@ firebase_core=/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/firebase_core-3.1.1/ firebase_core_web=/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/firebase_core_web-2.17.2/ firebase_storage=/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/firebase_storage-12.1.0/ firebase_storage_web=/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/firebase_storage_web-3.9.10/ -flutter_timezone=/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/flutter_timezone-2.0.0/ +flutter_timezone=/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/flutter_timezone-2.0.1/ package_info_plus=/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/package_info_plus-8.0.0/ path_provider_linux=/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/path_provider_linux-2.2.1/ path_provider_windows=/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/path_provider_windows-2.2.1/ diff --git a/data/.flutter-plugins-dependencies b/data/.flutter-plugins-dependencies index 65422cb8..e4f00e14 100644 --- a/data/.flutter-plugins-dependencies +++ b/data/.flutter-plugins-dependencies @@ -1 +1 @@ -{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"cloud_firestore","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/cloud_firestore-5.0.2/","native_build":true,"dependencies":["firebase_core"]},{"name":"device_info_plus","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/device_info_plus-10.1.0/","native_build":true,"dependencies":[]},{"name":"firebase_auth","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/firebase_auth-5.1.1/","native_build":true,"dependencies":["firebase_core"]},{"name":"firebase_core","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/firebase_core-3.1.1/","native_build":true,"dependencies":[]},{"name":"firebase_storage","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/firebase_storage-12.1.0/","native_build":true,"dependencies":["firebase_core"]},{"name":"flutter_timezone","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/flutter_timezone-2.0.0/","native_build":true,"dependencies":[]},{"name":"package_info_plus","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/package_info_plus-8.0.0/","native_build":true,"dependencies":[]},{"name":"shared_preferences_foundation","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/shared_preferences_foundation-2.4.0/","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"android":[{"name":"cloud_firestore","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/cloud_firestore-5.0.2/","native_build":true,"dependencies":["firebase_core"]},{"name":"device_info_plus","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/device_info_plus-10.1.0/","native_build":true,"dependencies":[]},{"name":"firebase_auth","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/firebase_auth-5.1.1/","native_build":true,"dependencies":["firebase_core"]},{"name":"firebase_core","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/firebase_core-3.1.1/","native_build":true,"dependencies":[]},{"name":"firebase_storage","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/firebase_storage-12.1.0/","native_build":true,"dependencies":["firebase_core"]},{"name":"flutter_timezone","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/flutter_timezone-2.0.0/","native_build":true,"dependencies":[]},{"name":"package_info_plus","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/package_info_plus-8.0.0/","native_build":true,"dependencies":[]},{"name":"shared_preferences_android","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/shared_preferences_android-2.2.3/","native_build":true,"dependencies":[]}],"macos":[{"name":"cloud_firestore","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/cloud_firestore-5.0.2/","native_build":true,"dependencies":["firebase_core"]},{"name":"device_info_plus","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/device_info_plus-10.1.0/","native_build":true,"dependencies":[]},{"name":"firebase_auth","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/firebase_auth-5.1.1/","native_build":true,"dependencies":["firebase_core"]},{"name":"firebase_core","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/firebase_core-3.1.1/","native_build":true,"dependencies":[]},{"name":"firebase_storage","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/firebase_storage-12.1.0/","native_build":true,"dependencies":["firebase_core"]},{"name":"flutter_timezone","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/flutter_timezone-2.0.0/","native_build":true,"dependencies":[]},{"name":"package_info_plus","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/package_info_plus-8.0.0/","native_build":true,"dependencies":[]},{"name":"shared_preferences_foundation","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/shared_preferences_foundation-2.4.0/","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"linux":[{"name":"device_info_plus","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/device_info_plus-10.1.0/","native_build":false,"dependencies":[]},{"name":"package_info_plus","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/package_info_plus-8.0.0/","native_build":false,"dependencies":[]},{"name":"path_provider_linux","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/path_provider_linux-2.2.1/","native_build":false,"dependencies":[]},{"name":"shared_preferences_linux","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/shared_preferences_linux-2.3.2/","native_build":false,"dependencies":["path_provider_linux"]}],"windows":[{"name":"cloud_firestore","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/cloud_firestore-5.0.2/","native_build":true,"dependencies":["firebase_core"]},{"name":"device_info_plus","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/device_info_plus-10.1.0/","native_build":false,"dependencies":[]},{"name":"firebase_auth","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/firebase_auth-5.1.1/","native_build":true,"dependencies":["firebase_core"]},{"name":"firebase_core","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/firebase_core-3.1.1/","native_build":true,"dependencies":[]},{"name":"firebase_storage","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/firebase_storage-12.1.0/","native_build":true,"dependencies":["firebase_core"]},{"name":"package_info_plus","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/package_info_plus-8.0.0/","native_build":false,"dependencies":[]},{"name":"path_provider_windows","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/path_provider_windows-2.2.1/","native_build":false,"dependencies":[]},{"name":"shared_preferences_windows","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/shared_preferences_windows-2.3.2/","native_build":false,"dependencies":["path_provider_windows"]}],"web":[{"name":"cloud_firestore_web","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/cloud_firestore_web-4.0.2/","dependencies":["firebase_core_web"]},{"name":"device_info_plus","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/device_info_plus-10.1.0/","dependencies":[]},{"name":"firebase_auth_web","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/firebase_auth_web-5.12.3/","dependencies":["firebase_core_web"]},{"name":"firebase_core_web","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/firebase_core_web-2.17.2/","dependencies":[]},{"name":"firebase_storage_web","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/firebase_storage_web-3.9.10/","dependencies":["firebase_core_web"]},{"name":"flutter_timezone","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/flutter_timezone-2.0.0/","dependencies":[]},{"name":"package_info_plus","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/package_info_plus-8.0.0/","dependencies":[]},{"name":"shared_preferences_web","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/shared_preferences_web-2.3.0/","dependencies":[]}]},"dependencyGraph":[{"name":"cloud_firestore","dependencies":["cloud_firestore_web","firebase_core"]},{"name":"cloud_firestore_web","dependencies":["firebase_core","firebase_core_web"]},{"name":"device_info_plus","dependencies":[]},{"name":"firebase_auth","dependencies":["firebase_auth_web","firebase_core"]},{"name":"firebase_auth_web","dependencies":["firebase_core","firebase_core_web"]},{"name":"firebase_core","dependencies":["firebase_core_web"]},{"name":"firebase_core_web","dependencies":[]},{"name":"firebase_storage","dependencies":["firebase_core","firebase_storage_web"]},{"name":"firebase_storage_web","dependencies":["firebase_core","firebase_core_web"]},{"name":"flutter_timezone","dependencies":[]},{"name":"package_info_plus","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]},{"name":"shared_preferences","dependencies":["shared_preferences_android","shared_preferences_foundation","shared_preferences_linux","shared_preferences_web","shared_preferences_windows"]},{"name":"shared_preferences_android","dependencies":[]},{"name":"shared_preferences_foundation","dependencies":[]},{"name":"shared_preferences_linux","dependencies":["path_provider_linux"]},{"name":"shared_preferences_web","dependencies":[]},{"name":"shared_preferences_windows","dependencies":["path_provider_windows"]}],"date_created":"2024-07-08 12:46:55.399944","version":"3.22.2"} \ No newline at end of file +{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"cloud_firestore","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/cloud_firestore-5.0.2/","native_build":true,"dependencies":["firebase_core"]},{"name":"device_info_plus","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/device_info_plus-10.1.0/","native_build":true,"dependencies":[]},{"name":"firebase_auth","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/firebase_auth-5.1.1/","native_build":true,"dependencies":["firebase_core"]},{"name":"firebase_core","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/firebase_core-3.1.1/","native_build":true,"dependencies":[]},{"name":"firebase_storage","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/firebase_storage-12.1.0/","native_build":true,"dependencies":["firebase_core"]},{"name":"flutter_timezone","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/flutter_timezone-2.0.1/","native_build":true,"dependencies":[]},{"name":"package_info_plus","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/package_info_plus-8.0.0/","native_build":true,"dependencies":[]},{"name":"shared_preferences_foundation","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/shared_preferences_foundation-2.4.0/","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"android":[{"name":"cloud_firestore","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/cloud_firestore-5.0.2/","native_build":true,"dependencies":["firebase_core"]},{"name":"device_info_plus","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/device_info_plus-10.1.0/","native_build":true,"dependencies":[]},{"name":"firebase_auth","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/firebase_auth-5.1.1/","native_build":true,"dependencies":["firebase_core"]},{"name":"firebase_core","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/firebase_core-3.1.1/","native_build":true,"dependencies":[]},{"name":"firebase_storage","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/firebase_storage-12.1.0/","native_build":true,"dependencies":["firebase_core"]},{"name":"flutter_timezone","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/flutter_timezone-2.0.1/","native_build":true,"dependencies":[]},{"name":"package_info_plus","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/package_info_plus-8.0.0/","native_build":true,"dependencies":[]},{"name":"shared_preferences_android","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/shared_preferences_android-2.2.3/","native_build":true,"dependencies":[]}],"macos":[{"name":"cloud_firestore","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/cloud_firestore-5.0.2/","native_build":true,"dependencies":["firebase_core"]},{"name":"device_info_plus","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/device_info_plus-10.1.0/","native_build":true,"dependencies":[]},{"name":"firebase_auth","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/firebase_auth-5.1.1/","native_build":true,"dependencies":["firebase_core"]},{"name":"firebase_core","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/firebase_core-3.1.1/","native_build":true,"dependencies":[]},{"name":"firebase_storage","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/firebase_storage-12.1.0/","native_build":true,"dependencies":["firebase_core"]},{"name":"flutter_timezone","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/flutter_timezone-2.0.1/","native_build":true,"dependencies":[]},{"name":"package_info_plus","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/package_info_plus-8.0.0/","native_build":true,"dependencies":[]},{"name":"shared_preferences_foundation","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/shared_preferences_foundation-2.4.0/","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"linux":[{"name":"device_info_plus","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/device_info_plus-10.1.0/","native_build":false,"dependencies":[]},{"name":"package_info_plus","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/package_info_plus-8.0.0/","native_build":false,"dependencies":[]},{"name":"path_provider_linux","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/path_provider_linux-2.2.1/","native_build":false,"dependencies":[]},{"name":"shared_preferences_linux","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/shared_preferences_linux-2.3.2/","native_build":false,"dependencies":["path_provider_linux"]}],"windows":[{"name":"cloud_firestore","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/cloud_firestore-5.0.2/","native_build":true,"dependencies":["firebase_core"]},{"name":"device_info_plus","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/device_info_plus-10.1.0/","native_build":false,"dependencies":[]},{"name":"firebase_auth","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/firebase_auth-5.1.1/","native_build":true,"dependencies":["firebase_core"]},{"name":"firebase_core","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/firebase_core-3.1.1/","native_build":true,"dependencies":[]},{"name":"firebase_storage","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/firebase_storage-12.1.0/","native_build":true,"dependencies":["firebase_core"]},{"name":"package_info_plus","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/package_info_plus-8.0.0/","native_build":false,"dependencies":[]},{"name":"path_provider_windows","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/path_provider_windows-2.2.1/","native_build":false,"dependencies":[]},{"name":"shared_preferences_windows","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/shared_preferences_windows-2.3.2/","native_build":false,"dependencies":["path_provider_windows"]}],"web":[{"name":"cloud_firestore_web","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/cloud_firestore_web-4.0.2/","dependencies":["firebase_core_web"]},{"name":"device_info_plus","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/device_info_plus-10.1.0/","dependencies":[]},{"name":"firebase_auth_web","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/firebase_auth_web-5.12.3/","dependencies":["firebase_core_web"]},{"name":"firebase_core_web","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/firebase_core_web-2.17.2/","dependencies":[]},{"name":"firebase_storage_web","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/firebase_storage_web-3.9.10/","dependencies":["firebase_core_web"]},{"name":"flutter_timezone","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/flutter_timezone-2.0.1/","dependencies":[]},{"name":"package_info_plus","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/package_info_plus-8.0.0/","dependencies":[]},{"name":"shared_preferences_web","path":"/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/shared_preferences_web-2.3.0/","dependencies":[]}]},"dependencyGraph":[{"name":"cloud_firestore","dependencies":["cloud_firestore_web","firebase_core"]},{"name":"cloud_firestore_web","dependencies":["firebase_core","firebase_core_web"]},{"name":"device_info_plus","dependencies":[]},{"name":"firebase_auth","dependencies":["firebase_auth_web","firebase_core"]},{"name":"firebase_auth_web","dependencies":["firebase_core","firebase_core_web"]},{"name":"firebase_core","dependencies":["firebase_core_web"]},{"name":"firebase_core_web","dependencies":[]},{"name":"firebase_storage","dependencies":["firebase_core","firebase_storage_web"]},{"name":"firebase_storage_web","dependencies":["firebase_core","firebase_core_web"]},{"name":"flutter_timezone","dependencies":[]},{"name":"package_info_plus","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]},{"name":"shared_preferences","dependencies":["shared_preferences_android","shared_preferences_foundation","shared_preferences_linux","shared_preferences_web","shared_preferences_windows"]},{"name":"shared_preferences_android","dependencies":[]},{"name":"shared_preferences_foundation","dependencies":[]},{"name":"shared_preferences_linux","dependencies":["path_provider_linux"]},{"name":"shared_preferences_web","dependencies":[]},{"name":"shared_preferences_windows","dependencies":["path_provider_windows"]}],"date_created":"2024-08-21 13:01:45.380620","version":"3.24.0","swift_package_manager_enabled":false} \ No newline at end of file diff --git a/data/lib/api/innings/inning_model.dart b/data/lib/api/innings/inning_model.dart index a08d0855..7b484930 100644 --- a/data/lib/api/innings/inning_model.dart +++ b/data/lib/api/innings/inning_model.dart @@ -10,10 +10,11 @@ part 'inning_model.g.dart'; @freezed class InningModel with _$InningModel { const factory InningModel({ - String? id, + required String id, required String match_id, required String team_id, @Default(0) double overs, + @Default(0) int index, @Default(0) int total_runs, @Default(0) int total_wickets, InningStatus? innings_status, diff --git a/data/lib/api/innings/inning_model.freezed.dart b/data/lib/api/innings/inning_model.freezed.dart index ab91a4a0..b5f3d90e 100644 --- a/data/lib/api/innings/inning_model.freezed.dart +++ b/data/lib/api/innings/inning_model.freezed.dart @@ -20,10 +20,11 @@ InningModel _$InningModelFromJson(Map json) { /// @nodoc mixin _$InningModel { - String? get id => throw _privateConstructorUsedError; + String get id => throw _privateConstructorUsedError; String get match_id => throw _privateConstructorUsedError; String get team_id => throw _privateConstructorUsedError; double get overs => throw _privateConstructorUsedError; + int get index => throw _privateConstructorUsedError; int get total_runs => throw _privateConstructorUsedError; int get total_wickets => throw _privateConstructorUsedError; InningStatus? get innings_status => throw _privateConstructorUsedError; @@ -41,10 +42,11 @@ abstract class $InningModelCopyWith<$Res> { _$InningModelCopyWithImpl<$Res, InningModel>; @useResult $Res call( - {String? id, + {String id, String match_id, String team_id, double overs, + int index, int total_runs, int total_wickets, InningStatus? innings_status}); @@ -63,19 +65,20 @@ class _$InningModelCopyWithImpl<$Res, $Val extends InningModel> @pragma('vm:prefer-inline') @override $Res call({ - Object? id = freezed, + Object? id = null, Object? match_id = null, Object? team_id = null, Object? overs = null, + Object? index = null, Object? total_runs = null, Object? total_wickets = null, Object? innings_status = freezed, }) { return _then(_value.copyWith( - id: freezed == id + id: null == id ? _value.id : id // ignore: cast_nullable_to_non_nullable - as String?, + as String, match_id: null == match_id ? _value.match_id : match_id // ignore: cast_nullable_to_non_nullable @@ -88,6 +91,10 @@ class _$InningModelCopyWithImpl<$Res, $Val extends InningModel> ? _value.overs : overs // ignore: cast_nullable_to_non_nullable as double, + index: null == index + ? _value.index + : index // ignore: cast_nullable_to_non_nullable + as int, total_runs: null == total_runs ? _value.total_runs : total_runs // ignore: cast_nullable_to_non_nullable @@ -113,10 +120,11 @@ abstract class _$$InningModelImplCopyWith<$Res> @override @useResult $Res call( - {String? id, + {String id, String match_id, String team_id, double overs, + int index, int total_runs, int total_wickets, InningStatus? innings_status}); @@ -133,19 +141,20 @@ class __$$InningModelImplCopyWithImpl<$Res> @pragma('vm:prefer-inline') @override $Res call({ - Object? id = freezed, + Object? id = null, Object? match_id = null, Object? team_id = null, Object? overs = null, + Object? index = null, Object? total_runs = null, Object? total_wickets = null, Object? innings_status = freezed, }) { return _then(_$InningModelImpl( - id: freezed == id + id: null == id ? _value.id : id // ignore: cast_nullable_to_non_nullable - as String?, + as String, match_id: null == match_id ? _value.match_id : match_id // ignore: cast_nullable_to_non_nullable @@ -158,6 +167,10 @@ class __$$InningModelImplCopyWithImpl<$Res> ? _value.overs : overs // ignore: cast_nullable_to_non_nullable as double, + index: null == index + ? _value.index + : index // ignore: cast_nullable_to_non_nullable + as int, total_runs: null == total_runs ? _value.total_runs : total_runs // ignore: cast_nullable_to_non_nullable @@ -178,10 +191,11 @@ class __$$InningModelImplCopyWithImpl<$Res> @JsonSerializable() class _$InningModelImpl implements _InningModel { const _$InningModelImpl( - {this.id, + {required this.id, required this.match_id, required this.team_id, this.overs = 0, + this.index = 0, this.total_runs = 0, this.total_wickets = 0, this.innings_status}); @@ -190,7 +204,7 @@ class _$InningModelImpl implements _InningModel { _$$InningModelImplFromJson(json); @override - final String? id; + final String id; @override final String match_id; @override @@ -200,6 +214,9 @@ class _$InningModelImpl implements _InningModel { final double overs; @override @JsonKey() + final int index; + @override + @JsonKey() final int total_runs; @override @JsonKey() @@ -209,7 +226,7 @@ class _$InningModelImpl implements _InningModel { @override String toString() { - return 'InningModel(id: $id, match_id: $match_id, team_id: $team_id, overs: $overs, total_runs: $total_runs, total_wickets: $total_wickets, innings_status: $innings_status)'; + return 'InningModel(id: $id, match_id: $match_id, team_id: $team_id, overs: $overs, index: $index, total_runs: $total_runs, total_wickets: $total_wickets, innings_status: $innings_status)'; } @override @@ -222,6 +239,7 @@ class _$InningModelImpl implements _InningModel { other.match_id == match_id) && (identical(other.team_id, team_id) || other.team_id == team_id) && (identical(other.overs, overs) || other.overs == overs) && + (identical(other.index, index) || other.index == index) && (identical(other.total_runs, total_runs) || other.total_runs == total_runs) && (identical(other.total_wickets, total_wickets) || @@ -233,7 +251,7 @@ class _$InningModelImpl implements _InningModel { @JsonKey(ignore: true) @override int get hashCode => Object.hash(runtimeType, id, match_id, team_id, overs, - total_runs, total_wickets, innings_status); + index, total_runs, total_wickets, innings_status); @JsonKey(ignore: true) @override @@ -251,10 +269,11 @@ class _$InningModelImpl implements _InningModel { abstract class _InningModel implements InningModel { const factory _InningModel( - {final String? id, + {required final String id, required final String match_id, required final String team_id, final double overs, + final int index, final int total_runs, final int total_wickets, final InningStatus? innings_status}) = _$InningModelImpl; @@ -263,7 +282,7 @@ abstract class _InningModel implements InningModel { _$InningModelImpl.fromJson; @override - String? get id; + String get id; @override String get match_id; @override @@ -271,6 +290,8 @@ abstract class _InningModel implements InningModel { @override double get overs; @override + int get index; + @override int get total_runs; @override int get total_wickets; diff --git a/data/lib/api/innings/inning_model.g.dart b/data/lib/api/innings/inning_model.g.dart index 174bc158..23cb06db 100644 --- a/data/lib/api/innings/inning_model.g.dart +++ b/data/lib/api/innings/inning_model.g.dart @@ -8,10 +8,11 @@ part of 'inning_model.dart'; _$InningModelImpl _$$InningModelImplFromJson(Map json) => _$InningModelImpl( - id: json['id'] as String?, + id: json['id'] as String, match_id: json['match_id'] as String, team_id: json['team_id'] as String, overs: (json['overs'] as num?)?.toDouble() ?? 0, + index: (json['index'] as num?)?.toInt() ?? 0, total_runs: (json['total_runs'] as num?)?.toInt() ?? 0, total_wickets: (json['total_wickets'] as num?)?.toInt() ?? 0, innings_status: @@ -24,6 +25,7 @@ Map _$$InningModelImplToJson(_$InningModelImpl instance) => 'match_id': instance.match_id, 'team_id': instance.team_id, 'overs': instance.overs, + 'index': instance.index, 'total_runs': instance.total_runs, 'total_wickets': instance.total_wickets, 'innings_status': _$InningStatusEnumMap[instance.innings_status], diff --git a/data/lib/api/match/match_model.dart b/data/lib/api/match/match_model.dart index 1fb85980..46a9e6dd 100644 --- a/data/lib/api/match/match_model.dart +++ b/data/lib/api/match/match_model.dart @@ -128,14 +128,25 @@ class MatchResult { class MatchPlayer with _$MatchPlayer { const factory MatchPlayer({ required UserModel player, - PlayerStatus? status, - int? index, + @Default([]) List performance, }) = _MatchPlayer; factory MatchPlayer.fromJson(Map json) => _$MatchPlayerFromJson(json); } +@freezed +class PlayerPerformance with _$PlayerPerformance { + const factory PlayerPerformance({ + required String inning_id, + PlayerStatus? status, + int? index, + }) = _PlayerPerformance; + + factory PlayerPerformance.fromJson(Map json) => + _$PlayerPerformanceFromJson(json); +} + @freezed class AddEditMatchRequest with _$AddEditMatchRequest { // ignore: invalid_annotation_target @@ -201,8 +212,9 @@ class MatchPlayerRequest with _$MatchPlayerRequest { @JsonSerializable(anyMap: true, explicitToJson: true) const factory MatchPlayerRequest({ required String id, - required PlayerStatus status, - int? index, + @Default(PlayerStatus.played) + PlayerStatus status, // TODO: Remove after release + @Default([]) List performance, }) = _MatchPlayerRequest; factory MatchPlayerRequest.fromJson(Map json) => diff --git a/data/lib/api/match/match_model.freezed.dart b/data/lib/api/match/match_model.freezed.dart index e22c931a..43363f00 100644 --- a/data/lib/api/match/match_model.freezed.dart +++ b/data/lib/api/match/match_model.freezed.dart @@ -1075,8 +1075,7 @@ MatchPlayer _$MatchPlayerFromJson(Map json) { /// @nodoc mixin _$MatchPlayer { UserModel get player => throw _privateConstructorUsedError; - PlayerStatus? get status => throw _privateConstructorUsedError; - int? get index => throw _privateConstructorUsedError; + List get performance => throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) @@ -1090,7 +1089,7 @@ abstract class $MatchPlayerCopyWith<$Res> { MatchPlayer value, $Res Function(MatchPlayer) then) = _$MatchPlayerCopyWithImpl<$Res, MatchPlayer>; @useResult - $Res call({UserModel player, PlayerStatus? status, int? index}); + $Res call({UserModel player, List performance}); $UserModelCopyWith<$Res> get player; } @@ -1109,22 +1108,17 @@ class _$MatchPlayerCopyWithImpl<$Res, $Val extends MatchPlayer> @override $Res call({ Object? player = null, - Object? status = freezed, - Object? index = freezed, + Object? performance = null, }) { return _then(_value.copyWith( player: null == player ? _value.player : player // ignore: cast_nullable_to_non_nullable as UserModel, - status: freezed == status - ? _value.status - : status // ignore: cast_nullable_to_non_nullable - as PlayerStatus?, - index: freezed == index - ? _value.index - : index // ignore: cast_nullable_to_non_nullable - as int?, + performance: null == performance + ? _value.performance + : performance // ignore: cast_nullable_to_non_nullable + as List, ) as $Val); } @@ -1145,7 +1139,7 @@ abstract class _$$MatchPlayerImplCopyWith<$Res> __$$MatchPlayerImplCopyWithImpl<$Res>; @override @useResult - $Res call({UserModel player, PlayerStatus? status, int? index}); + $Res call({UserModel player, List performance}); @override $UserModelCopyWith<$Res> get player; @@ -1163,22 +1157,17 @@ class __$$MatchPlayerImplCopyWithImpl<$Res> @override $Res call({ Object? player = null, - Object? status = freezed, - Object? index = freezed, + Object? performance = null, }) { return _then(_$MatchPlayerImpl( player: null == player ? _value.player : player // ignore: cast_nullable_to_non_nullable as UserModel, - status: freezed == status - ? _value.status - : status // ignore: cast_nullable_to_non_nullable - as PlayerStatus?, - index: freezed == index - ? _value.index - : index // ignore: cast_nullable_to_non_nullable - as int?, + performance: null == performance + ? _value._performance + : performance // ignore: cast_nullable_to_non_nullable + as List, )); } } @@ -1186,21 +1175,28 @@ class __$$MatchPlayerImplCopyWithImpl<$Res> /// @nodoc @JsonSerializable() class _$MatchPlayerImpl implements _MatchPlayer { - const _$MatchPlayerImpl({required this.player, this.status, this.index}); + const _$MatchPlayerImpl( + {required this.player, + final List performance = const []}) + : _performance = performance; factory _$MatchPlayerImpl.fromJson(Map json) => _$$MatchPlayerImplFromJson(json); @override final UserModel player; + final List _performance; @override - final PlayerStatus? status; - @override - final int? index; + @JsonKey() + List get performance { + if (_performance is EqualUnmodifiableListView) return _performance; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_performance); + } @override String toString() { - return 'MatchPlayer(player: $player, status: $status, index: $index)'; + return 'MatchPlayer(player: $player, performance: $performance)'; } @override @@ -1209,13 +1205,14 @@ class _$MatchPlayerImpl implements _MatchPlayer { (other.runtimeType == runtimeType && other is _$MatchPlayerImpl && (identical(other.player, player) || other.player == player) && - (identical(other.status, status) || other.status == status) && - (identical(other.index, index) || other.index == index)); + const DeepCollectionEquality() + .equals(other._performance, _performance)); } @JsonKey(ignore: true) @override - int get hashCode => Object.hash(runtimeType, player, status, index); + int get hashCode => Object.hash( + runtimeType, player, const DeepCollectionEquality().hash(_performance)); @JsonKey(ignore: true) @override @@ -1234,8 +1231,7 @@ class _$MatchPlayerImpl implements _MatchPlayer { abstract class _MatchPlayer implements MatchPlayer { const factory _MatchPlayer( {required final UserModel player, - final PlayerStatus? status, - final int? index}) = _$MatchPlayerImpl; + final List performance}) = _$MatchPlayerImpl; factory _MatchPlayer.fromJson(Map json) = _$MatchPlayerImpl.fromJson; @@ -1243,12 +1239,184 @@ abstract class _MatchPlayer implements MatchPlayer { @override UserModel get player; @override + List get performance; + @override + @JsonKey(ignore: true) + _$$MatchPlayerImplCopyWith<_$MatchPlayerImpl> get copyWith => + throw _privateConstructorUsedError; +} + +PlayerPerformance _$PlayerPerformanceFromJson(Map json) { + return _PlayerPerformance.fromJson(json); +} + +/// @nodoc +mixin _$PlayerPerformance { + String get inning_id => throw _privateConstructorUsedError; + PlayerStatus? get status => throw _privateConstructorUsedError; + int? get index => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $PlayerPerformanceCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $PlayerPerformanceCopyWith<$Res> { + factory $PlayerPerformanceCopyWith( + PlayerPerformance value, $Res Function(PlayerPerformance) then) = + _$PlayerPerformanceCopyWithImpl<$Res, PlayerPerformance>; + @useResult + $Res call({String inning_id, PlayerStatus? status, int? index}); +} + +/// @nodoc +class _$PlayerPerformanceCopyWithImpl<$Res, $Val extends PlayerPerformance> + implements $PlayerPerformanceCopyWith<$Res> { + _$PlayerPerformanceCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? inning_id = null, + Object? status = freezed, + Object? index = freezed, + }) { + return _then(_value.copyWith( + inning_id: null == inning_id + ? _value.inning_id + : inning_id // ignore: cast_nullable_to_non_nullable + as String, + status: freezed == status + ? _value.status + : status // ignore: cast_nullable_to_non_nullable + as PlayerStatus?, + index: freezed == index + ? _value.index + : index // ignore: cast_nullable_to_non_nullable + as int?, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$PlayerPerformanceImplCopyWith<$Res> + implements $PlayerPerformanceCopyWith<$Res> { + factory _$$PlayerPerformanceImplCopyWith(_$PlayerPerformanceImpl value, + $Res Function(_$PlayerPerformanceImpl) then) = + __$$PlayerPerformanceImplCopyWithImpl<$Res>; + @override + @useResult + $Res call({String inning_id, PlayerStatus? status, int? index}); +} + +/// @nodoc +class __$$PlayerPerformanceImplCopyWithImpl<$Res> + extends _$PlayerPerformanceCopyWithImpl<$Res, _$PlayerPerformanceImpl> + implements _$$PlayerPerformanceImplCopyWith<$Res> { + __$$PlayerPerformanceImplCopyWithImpl(_$PlayerPerformanceImpl _value, + $Res Function(_$PlayerPerformanceImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? inning_id = null, + Object? status = freezed, + Object? index = freezed, + }) { + return _then(_$PlayerPerformanceImpl( + inning_id: null == inning_id + ? _value.inning_id + : inning_id // ignore: cast_nullable_to_non_nullable + as String, + status: freezed == status + ? _value.status + : status // ignore: cast_nullable_to_non_nullable + as PlayerStatus?, + index: freezed == index + ? _value.index + : index // ignore: cast_nullable_to_non_nullable + as int?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$PlayerPerformanceImpl implements _PlayerPerformance { + const _$PlayerPerformanceImpl( + {required this.inning_id, this.status, this.index}); + + factory _$PlayerPerformanceImpl.fromJson(Map json) => + _$$PlayerPerformanceImplFromJson(json); + + @override + final String inning_id; + @override + final PlayerStatus? status; + @override + final int? index; + + @override + String toString() { + return 'PlayerPerformance(inning_id: $inning_id, status: $status, index: $index)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$PlayerPerformanceImpl && + (identical(other.inning_id, inning_id) || + other.inning_id == inning_id) && + (identical(other.status, status) || other.status == status) && + (identical(other.index, index) || other.index == index)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, inning_id, status, index); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$PlayerPerformanceImplCopyWith<_$PlayerPerformanceImpl> get copyWith => + __$$PlayerPerformanceImplCopyWithImpl<_$PlayerPerformanceImpl>( + this, _$identity); + + @override + Map toJson() { + return _$$PlayerPerformanceImplToJson( + this, + ); + } +} + +abstract class _PlayerPerformance implements PlayerPerformance { + const factory _PlayerPerformance( + {required final String inning_id, + final PlayerStatus? status, + final int? index}) = _$PlayerPerformanceImpl; + + factory _PlayerPerformance.fromJson(Map json) = + _$PlayerPerformanceImpl.fromJson; + + @override + String get inning_id; + @override PlayerStatus? get status; @override int? get index; @override @JsonKey(ignore: true) - _$$MatchPlayerImplCopyWith<_$MatchPlayerImpl> get copyWith => + _$$PlayerPerformanceImplCopyWith<_$PlayerPerformanceImpl> get copyWith => throw _privateConstructorUsedError; } @@ -2292,8 +2460,9 @@ MatchPlayerRequest _$MatchPlayerRequestFromJson(Map json) { /// @nodoc mixin _$MatchPlayerRequest { String get id => throw _privateConstructorUsedError; - PlayerStatus get status => throw _privateConstructorUsedError; - int? get index => throw _privateConstructorUsedError; + PlayerStatus get status => + throw _privateConstructorUsedError; // TODO: Remove after release + List get performance => throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) @@ -2307,7 +2476,8 @@ abstract class $MatchPlayerRequestCopyWith<$Res> { MatchPlayerRequest value, $Res Function(MatchPlayerRequest) then) = _$MatchPlayerRequestCopyWithImpl<$Res, MatchPlayerRequest>; @useResult - $Res call({String id, PlayerStatus status, int? index}); + $Res call( + {String id, PlayerStatus status, List performance}); } /// @nodoc @@ -2325,7 +2495,7 @@ class _$MatchPlayerRequestCopyWithImpl<$Res, $Val extends MatchPlayerRequest> $Res call({ Object? id = null, Object? status = null, - Object? index = freezed, + Object? performance = null, }) { return _then(_value.copyWith( id: null == id @@ -2336,10 +2506,10 @@ class _$MatchPlayerRequestCopyWithImpl<$Res, $Val extends MatchPlayerRequest> ? _value.status : status // ignore: cast_nullable_to_non_nullable as PlayerStatus, - index: freezed == index - ? _value.index - : index // ignore: cast_nullable_to_non_nullable - as int?, + performance: null == performance + ? _value.performance + : performance // ignore: cast_nullable_to_non_nullable + as List, ) as $Val); } } @@ -2352,7 +2522,8 @@ abstract class _$$MatchPlayerRequestImplCopyWith<$Res> __$$MatchPlayerRequestImplCopyWithImpl<$Res>; @override @useResult - $Res call({String id, PlayerStatus status, int? index}); + $Res call( + {String id, PlayerStatus status, List performance}); } /// @nodoc @@ -2368,7 +2539,7 @@ class __$$MatchPlayerRequestImplCopyWithImpl<$Res> $Res call({ Object? id = null, Object? status = null, - Object? index = freezed, + Object? performance = null, }) { return _then(_$MatchPlayerRequestImpl( id: null == id @@ -2379,10 +2550,10 @@ class __$$MatchPlayerRequestImplCopyWithImpl<$Res> ? _value.status : status // ignore: cast_nullable_to_non_nullable as PlayerStatus, - index: freezed == index - ? _value.index - : index // ignore: cast_nullable_to_non_nullable - as int?, + performance: null == performance + ? _value._performance + : performance // ignore: cast_nullable_to_non_nullable + as List, )); } } @@ -2392,7 +2563,10 @@ class __$$MatchPlayerRequestImplCopyWithImpl<$Res> @JsonSerializable(anyMap: true, explicitToJson: true) class _$MatchPlayerRequestImpl implements _MatchPlayerRequest { const _$MatchPlayerRequestImpl( - {required this.id, required this.status, this.index}); + {required this.id, + this.status = PlayerStatus.played, + final List performance = const []}) + : _performance = performance; factory _$MatchPlayerRequestImpl.fromJson(Map json) => _$$MatchPlayerRequestImplFromJson(json); @@ -2400,13 +2574,22 @@ class _$MatchPlayerRequestImpl implements _MatchPlayerRequest { @override final String id; @override + @JsonKey() final PlayerStatus status; +// TODO: Remove after release + final List _performance; +// TODO: Remove after release @override - final int? index; + @JsonKey() + List get performance { + if (_performance is EqualUnmodifiableListView) return _performance; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_performance); + } @override String toString() { - return 'MatchPlayerRequest(id: $id, status: $status, index: $index)'; + return 'MatchPlayerRequest(id: $id, status: $status, performance: $performance)'; } @override @@ -2416,12 +2599,14 @@ class _$MatchPlayerRequestImpl implements _MatchPlayerRequest { other is _$MatchPlayerRequestImpl && (identical(other.id, id) || other.id == id) && (identical(other.status, status) || other.status == status) && - (identical(other.index, index) || other.index == index)); + const DeepCollectionEquality() + .equals(other._performance, _performance)); } @JsonKey(ignore: true) @override - int get hashCode => Object.hash(runtimeType, id, status, index); + int get hashCode => Object.hash(runtimeType, id, status, + const DeepCollectionEquality().hash(_performance)); @JsonKey(ignore: true) @override @@ -2441,8 +2626,8 @@ class _$MatchPlayerRequestImpl implements _MatchPlayerRequest { abstract class _MatchPlayerRequest implements MatchPlayerRequest { const factory _MatchPlayerRequest( {required final String id, - required final PlayerStatus status, - final int? index}) = _$MatchPlayerRequestImpl; + final PlayerStatus status, + final List performance}) = _$MatchPlayerRequestImpl; factory _MatchPlayerRequest.fromJson(Map json) = _$MatchPlayerRequestImpl.fromJson; @@ -2451,8 +2636,8 @@ abstract class _MatchPlayerRequest implements MatchPlayerRequest { String get id; @override PlayerStatus get status; - @override - int? get index; + @override // TODO: Remove after release + List get performance; @override @JsonKey(ignore: true) _$$MatchPlayerRequestImplCopyWith<_$MatchPlayerRequestImpl> get copyWith => diff --git a/data/lib/api/match/match_model.g.dart b/data/lib/api/match/match_model.g.dart index ce688372..e17d07c5 100644 --- a/data/lib/api/match/match_model.g.dart +++ b/data/lib/api/match/match_model.g.dart @@ -156,13 +156,31 @@ Map _$$MatchTeamModelImplToJson( _$MatchPlayerImpl _$$MatchPlayerImplFromJson(Map json) => _$MatchPlayerImpl( player: UserModel.fromJson(json['player'] as Map), - status: $enumDecodeNullable(_$PlayerStatusEnumMap, json['status']), - index: (json['index'] as num?)?.toInt(), + performance: (json['performance'] as List?) + ?.map( + (e) => PlayerPerformance.fromJson(e as Map)) + .toList() ?? + const [], ); Map _$$MatchPlayerImplToJson(_$MatchPlayerImpl instance) => { 'player': instance.player, + 'performance': instance.performance, + }; + +_$PlayerPerformanceImpl _$$PlayerPerformanceImplFromJson( + Map json) => + _$PlayerPerformanceImpl( + inning_id: json['inning_id'] as String, + status: $enumDecodeNullable(_$PlayerStatusEnumMap, json['status']), + index: (json['index'] as num?)?.toInt(), + ); + +Map _$$PlayerPerformanceImplToJson( + _$PlayerPerformanceImpl instance) => + { + 'inning_id': instance.inning_id, 'status': _$PlayerStatusEnumMap[instance.status], 'index': instance.index, }; @@ -291,8 +309,13 @@ Map _$$AddMatchTeamRequestImplToJson( _$MatchPlayerRequestImpl _$$MatchPlayerRequestImplFromJson(Map json) => _$MatchPlayerRequestImpl( id: json['id'] as String, - status: $enumDecode(_$PlayerStatusEnumMap, json['status']), - index: (json['index'] as num?)?.toInt(), + status: $enumDecodeNullable(_$PlayerStatusEnumMap, json['status']) ?? + PlayerStatus.played, + performance: (json['performance'] as List?) + ?.map((e) => PlayerPerformance.fromJson( + Map.from(e as Map))) + .toList() ?? + const [], ); Map _$$MatchPlayerRequestImplToJson( @@ -300,5 +323,5 @@ Map _$$MatchPlayerRequestImplToJson( { 'id': instance.id, 'status': _$PlayerStatusEnumMap[instance.status]!, - 'index': instance.index, + 'performance': instance.performance.map((e) => e.toJson()).toList(), }; diff --git a/data/lib/errors/app_error.dart b/data/lib/errors/app_error.dart index 81059974..cbfd08c0 100644 --- a/data/lib/errors/app_error.dart +++ b/data/lib/errors/app_error.dart @@ -36,7 +36,8 @@ class AppError implements Exception { } else if (error is LargeAttachmentUploadError) { return const LargeAttachmentUploadError(); } else { - return SomethingWentWrongError(stackTrace: stack); + return SomethingWentWrongError( + message: error.toString(), stackTrace: stack); } } diff --git a/data/lib/extensions/list_extensions.dart b/data/lib/extensions/list_extensions.dart index 843e9214..e55aa812 100644 --- a/data/lib/extensions/list_extensions.dart +++ b/data/lib/extensions/list_extensions.dart @@ -3,11 +3,16 @@ extension ListExtension on List { List updateWhere({ required bool Function(E element) where, required E Function(E oldElement) updated, + E Function()? onNotFound, }) { final newList = toList(); final int index = newList.indexWhere(where); if (index >= 0) { newList[index] = updated(newList[index]); + } else { + if (onNotFound != null) { + newList.add(onNotFound()); + } } return newList; } diff --git a/data/lib/service/ball_score/ball_score_service.dart b/data/lib/service/ball_score/ball_score_service.dart index 5b9ed242..886b7ab7 100644 --- a/data/lib/service/ball_score/ball_score_service.dart +++ b/data/lib/service/ball_score/ball_score_service.dart @@ -2,6 +2,7 @@ import 'dart:async'; import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:data/api/ball_score/ball_score_model.dart'; import 'package:data/errors/app_error.dart'; +import 'package:data/extensions/double_extensions.dart'; import 'package:data/service/innings/inning_service.dart'; import 'package:data/service/match/match_service.dart'; import 'package:data/storage/app_preferences.dart'; @@ -47,6 +48,10 @@ class BallScoreService { required String bowlingTeamInningId, required int totalWicketTaken, int? totalBowlingTeamRuns, + double otherInningOver = 0, + int otherTotalRuns = 0, + int otherTotalWicketTaken = 0, + int otherTotalBowlingTeamRuns = 0, MatchPlayerRequest? updatedPlayer, }) async { try { @@ -59,11 +64,13 @@ class BallScoreService { await _matchService.updateTeamScoreAndSquadViaTransaction(transaction, matchId: matchId, battingTeamId: battingTeamId, - totalRun: totalRuns, - over: overCount, + totalRun: otherTotalRuns + totalRuns, + over: overCount.add(otherInningOver.toBalls()), bowlingTeamId: bowlingTeamId, - wicket: totalWicketTaken, - runs: totalBowlingTeamRuns, + wicket: otherTotalWicketTaken + totalWicketTaken, + runs: totalBowlingTeamRuns != null + ? otherTotalBowlingTeamRuns + totalBowlingTeamRuns + : null, updatedMatchPlayer: updatedPlayer != null ? [updatedPlayer] : null); // update innings score detail _inningsService.updateInningScoreDetailViaTransaction(transaction, @@ -126,6 +133,10 @@ class BallScoreService { required int totalWicketTaken, double? overCount, int? totalBowlingTeamRuns, + double otherInningOver = 0, + int otherTotalRuns = 0, + int otherTotalWicketTaken = 0, + int otherTotalBowlingTeamRuns = 0, List? updatedPlayer, }) async { try { @@ -134,11 +145,13 @@ class BallScoreService { await _matchService.updateTeamScoreAndSquadViaTransaction(transaction, matchId: matchId, battingTeamId: battingTeamId, - totalRun: totalRuns, - over: overCount, + totalRun: otherTotalRuns + totalRuns, + over: overCount?.add(otherInningOver.toBalls()), bowlingTeamId: bowlingTeamId, - wicket: totalWicketTaken, - runs: totalBowlingTeamRuns, + wicket: otherTotalWicketTaken + totalWicketTaken, + runs: totalBowlingTeamRuns != null + ? otherTotalBowlingTeamRuns + totalBowlingTeamRuns + : null, updatedMatchPlayer: updatedPlayer); // update innings score detail diff --git a/data/lib/service/innings/inning_service.dart b/data/lib/service/innings/inning_service.dart index c34e107b..85ff8400 100644 --- a/data/lib/service/innings/inning_service.dart +++ b/data/lib/service/innings/inning_service.dart @@ -23,41 +23,17 @@ class InningsService { fromFirestore: InningModel.fromFireStore, toFirestore: (InningModel inning, _) => inning.toJson()); + String get generateInningId => _inningCollection.doc().id; + Future createInnings({ - required String matchId, - required String teamId, - required InningStatus firstInningStatus, - required String opponentTeamId, - required InningStatus secondInningStatus, + required List innings, }) async { try { WriteBatch batch = _firestore.batch(); - final firstInningRef = _inningCollection.doc(); - final secondInningRef = _inningCollection.doc(); - - final firstInning = InningModel( - id: firstInningRef.id, - match_id: matchId, - team_id: teamId, - innings_status: firstInningStatus, - total_runs: 0, - overs: 0, - total_wickets: 0, - ); - - final secondInning = InningModel( - id: secondInningRef.id, - match_id: matchId, - team_id: opponentTeamId, - innings_status: secondInningStatus, - total_runs: 0, - overs: 0, - total_wickets: 0, - ); - - batch.set(firstInningRef, firstInning, SetOptions(merge: true)); - batch.set(secondInningRef, secondInning, SetOptions(merge: true)); - + for (final inning in innings) { + final inningRef = _inningCollection.doc(inning.id); + batch.set(inningRef, inning, SetOptions(merge: true)); + } await batch.commit(); } catch (error, stack) { throw AppError.fromError(error, stack); @@ -85,7 +61,6 @@ class InningsService { }) { try { final batInningRef = _inningCollection.doc(battingTeamInningId); - final bowlInningRef = _inningCollection.doc(bowlingTeamInningId); Map battingUpdates = { @@ -117,4 +92,21 @@ class InningsService { throw AppError.fromError(error, stack); } } + + Future updateInningsStatuses(Map innings) async { + try { + WriteBatch batch = _firestore.batch(); + + for (final inning in innings.entries) { + final inningRef = _inningCollection.doc(inning.key); + batch.update(inningRef, { + FireStoreConst.inningsStatus: inning.value.value, + }); + } + + await batch.commit(); + } catch (error, stack) { + throw AppError.fromError(error, stack); + } + } } diff --git a/data/lib/service/match/match_service.dart b/data/lib/service/match/match_service.dart index 70c3f802..775f0417 100644 --- a/data/lib/service/match/match_service.dart +++ b/data/lib/service/match/match_service.dart @@ -530,8 +530,7 @@ class MatchService { return MatchPlayer( player: user, - status: matchPlayer.status, - index: matchPlayer.index, + performance: matchPlayer.performance, ); }).toList(); diff --git a/khelo/assets/locales/app_en.arb b/khelo/assets/locales/app_en.arb index edacd85b..813605b7 100644 --- a/khelo/assets/locales/app_en.arb +++ b/khelo/assets/locales/app_en.arb @@ -50,6 +50,8 @@ "common_run_out_title": "Run Out", "common_wickets_text": "Wickets", "common_end_match_title": "End Match", + "common_first_inning_title": "First inning", + "common_second_inning_title": "Second inning", "common_obscure_phone_number_text": "{countryCode} ***** ***{lastDigits}", "@common_obscure_phone_number_text": { "description": "+{countryCode} ***** ***{lastDigits}", @@ -626,8 +628,10 @@ } } }, - "score_board_need_run_text": "Need {run} in {ball}", - "@score_board_need_run_text": { + "score_board_need_run_text": "Need {count, plural, =0{{count} Runs} =1{{count} Run} other{{count} Runs}}", + + "score_board_run_need_in_ball_text": "Need {run} in {ball}", + "@score_board_run_need_in_ball_text": { "description": "Need {run} in {ball}", "placeholders": { "run": { diff --git a/khelo/ios/Runner/AppDelegate.swift b/khelo/ios/Runner/AppDelegate.swift index 70693e4a..b6363034 100644 --- a/khelo/ios/Runner/AppDelegate.swift +++ b/khelo/ios/Runner/AppDelegate.swift @@ -1,7 +1,7 @@ import UIKit import Flutter -@UIApplicationMain +@main @objc class AppDelegate: FlutterAppDelegate { override func application( _ application: UIApplication, diff --git a/khelo/ios/Runner/Info.plist b/khelo/ios/Runner/Info.plist index 93080e1f..765c2c07 100644 --- a/khelo/ios/Runner/Info.plist +++ b/khelo/ios/Runner/Info.plist @@ -30,6 +30,7 @@ CFBundleURLSchemes app-1-753506519474-ios-8cd38557e090c0b51e7cab + app-1-92999931839-ios-f166ae55796f68ceac330a diff --git a/khelo/lib/components/match_detail_cell.dart b/khelo/lib/components/match_detail_cell.dart index 2307f7d5..09f79887 100644 --- a/khelo/lib/components/match_detail_cell.dart +++ b/khelo/lib/components/match_detail_cell.dart @@ -61,7 +61,8 @@ class MatchDetailCell extends StatelessWidget { MatchStatusTag( status: match.match_status, onTap: showActionButtons && - match.match_status != MatchStatus.finish + match.match_status != MatchStatus.finish && + match.match_status != MatchStatus.abandoned ? onActionTap : null, ) diff --git a/khelo/lib/ui/flow/matches/add_match/add_match_view_model.dart b/khelo/lib/ui/flow/matches/add_match/add_match_view_model.dart index 00c1d658..28d029e5 100644 --- a/khelo/lib/ui/flow/matches/add_match/add_match_view_model.dart +++ b/khelo/lib/ui/flow/matches/add_match/add_match_view_model.dart @@ -140,16 +140,16 @@ class AddMatchViewNotifier extends StateNotifier { final firstSquad = state.squadA ?.map((e) => MatchPlayerRequest( - id: e.player.id, - status: e.status ?? PlayerStatus.yetToPlay, - index: e.index)) + id: e.player.id, + performance: e.performance, + )) .toList() ?? []; final secondSquad = state.squadB ?.map((e) => MatchPlayerRequest( - id: e.player.id, - status: e.status ?? PlayerStatus.yetToPlay, - index: e.index)) + id: e.player.id, + performance: e.performance, + )) .toList() ?? []; final allPlayers = firstSquad.map((e) => e.id).toList(); @@ -232,10 +232,8 @@ class AddMatchViewNotifier extends StateNotifier { } void onTeamSelect(TeamModel team, TeamType type) { - final matchPlayer = team.players - ?.take(11) - .map((e) => MatchPlayer(player: e, status: PlayerStatus.yetToPlay)) - .toList(); + final matchPlayer = + team.players?.take(11).map((e) => MatchPlayer(player: e)).toList(); final captainAndAdminId = matchPlayer?.firstOrNull?.player.id; switch (type) { diff --git a/khelo/lib/ui/flow/matches/add_match/select_squad/select_squad_view_model.dart b/khelo/lib/ui/flow/matches/add_match/select_squad/select_squad_view_model.dart index 59d8a3ce..be3b08e4 100644 --- a/khelo/lib/ui/flow/matches/add_match/select_squad/select_squad_view_model.dart +++ b/khelo/lib/ui/flow/matches/add_match/select_squad/select_squad_view_model.dart @@ -32,7 +32,15 @@ class SelectSquadViewNotifier extends StateNotifier { void removeFromSquad(UserModel user) { final updatedList = state.squad.toList(); updatedList.removeWhere((element) => element.player.id == user.id); - state = state.copyWith(squad: updatedList); + final captainId = + updatedList.map((e) => e.player.id).contains(state.captainId) + ? state.captainId + : null; + final adminId = updatedList.map((e) => e.player.id).contains(state.adminId) + ? state.adminId + : null; + state = state.copyWith( + squad: updatedList, captainId: captainId, adminId: adminId); onSquadChange(); } @@ -53,6 +61,7 @@ class SelectSquadViewNotifier extends StateNotifier { void onSquadChange() { state = state.copyWith(isDoneBtnEnable: state.squad.length >= 2); + onSelectionChange(); } void onSelectionChange() { diff --git a/khelo/lib/ui/flow/matches/match_detail/components/match_detail_overs_view.dart b/khelo/lib/ui/flow/matches/match_detail/components/match_detail_overs_view.dart index d04d2453..3c1ebadd 100644 --- a/khelo/lib/ui/flow/matches/match_detail/components/match_detail_overs_view.dart +++ b/khelo/lib/ui/flow/matches/match_detail/components/match_detail_overs_view.dart @@ -63,8 +63,17 @@ class MatchDetailOversView extends ConsumerWidget { final nextOver = state.overList.elementAtOrNull(i + 1); if (nextOver?.inning_id != over.inning_id) { children.add( - _teamNameTitleView(context, state, over.inning_id, - state.firstInning?.id == over.inning_id ? 1 : 2), + _teamNameTitleView( + context, + state, + over.inning_id, + state.allInnings + .where( + (element) => element.id == over.inning_id, + ) + .firstOrNull + ?.index ?? + 1), ); } else { children.add(Divider(height: 32, color: context.colorScheme.outline)); @@ -133,9 +142,12 @@ class MatchDetailOversView extends ConsumerWidget { } String _getTeamNameByInningId(MatchDetailTabState state, String inningId) { - final teamId = state.firstInning?.id == inningId - ? state.firstInning?.team_id - : state.secondInning?.team_id; + final teamId = state.allInnings + .where( + (element) => element.id == inningId, + ) + .firstOrNull + ?.team_id; final teamName = state.match?.teams .where((element) => element.team.id == teamId) diff --git a/khelo/lib/ui/flow/matches/match_detail/components/match_detail_scorecard_view.dart b/khelo/lib/ui/flow/matches/match_detail/components/match_detail_scorecard_view.dart index 80edad22..e88e4d6a 100644 --- a/khelo/lib/ui/flow/matches/match_detail/components/match_detail_scorecard_view.dart +++ b/khelo/lib/ui/flow/matches/match_detail/components/match_detail_scorecard_view.dart @@ -81,17 +81,26 @@ class MatchDetailScorecardView extends ConsumerWidget { final batsmen = _getBatsmen(inningOvers); final bowler = _getBowlers(inningOvers); - final yetToPlayPlayers = state.match?.teams + final teamSquad = state.match?.teams .where((element) => element.team.id == overs?.team_id) .firstOrNull - ?.squad + ?.squad; + + final yetToPlayPlayers = teamSquad + ?.where((element) => element.performance + .where((element) => + element.inning_id == overs?.inning_id && + element.status == PlayerStatus.yetToPlay) + .isNotEmpty) .toList(); return _teamTitleView(context, teamName: _getTeamNameByTeamId(state, overs?.team_id ?? ""), + inningString: _getInningStringByInningId( + context, state, overs?.inning_id ?? ""), over: overs ?? const OverSummary(), - initiallyExpanded: state.expandedTeamScorecard - .contains(inningOvers.first.team_id), + initiallyExpanded: state.expandedInningsScorecard + .contains(inningOvers.first.inning_id), children: [ _dataTable(context, batsmen: batsmen), ..._buildMatchTotalView(context, @@ -103,7 +112,7 @@ class MatchDetailScorecardView extends ConsumerWidget { ], onExpansionChanged: (isExpanded) => notifier.onScorecardExpansionChange( - overs?.team_id ?? "", isExpanded)); + overs?.inning_id ?? "", isExpanded)); }, separatorBuilder: (context, index) => const SizedBox(height: 16), ), @@ -126,6 +135,7 @@ class MatchDetailScorecardView extends ConsumerWidget { Widget _teamTitleView( BuildContext context, { required String teamName, + String? inningString, required OverSummary over, required bool initiallyExpanded, required List children, @@ -156,12 +166,25 @@ class MatchDetailScorecardView extends ConsumerWidget { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Expanded( - child: Text( - teamName, - maxLines: 2, - overflow: TextOverflow.ellipsis, - style: AppTextStyle.subtitle1 - .copyWith(color: context.colorScheme.onPrimary), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + teamName, + maxLines: 2, + overflow: TextOverflow.ellipsis, + style: AppTextStyle.subtitle1 + .copyWith(color: context.colorScheme.onPrimary), + ), + if (inningString != null) + Text( + inningString, + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: AppTextStyle.caption + .copyWith(color: context.colorScheme.onPrimary), + ), + ], ), ), Text.rich( @@ -586,6 +609,24 @@ class MatchDetailScorecardView extends ConsumerWidget { ""; } + String? _getInningStringByInningId( + BuildContext context, MatchDetailTabState state, String inningId) { + if (state.match?.match_type != MatchType.testMatch) { + return null; + } + + final inningIndex = state.allInnings + .where((element) => element.id == inningId) + .firstOrNull + ?.index; + + if (inningIndex == 1 || inningIndex == 2) { + return context.l10n.common_first_inning_title; + } else { + return context.l10n.common_second_inning_title; + } + } + List _getBatsmen(List inningOvers) { final lastOver = inningOvers.lastOrNull; List batsmen = diff --git a/khelo/lib/ui/flow/matches/match_detail/match_detail_tab_view_model.dart b/khelo/lib/ui/flow/matches/match_detail/match_detail_tab_view_model.dart index 8efb07c6..c5e919c2 100644 --- a/khelo/lib/ui/flow/matches/match_detail/match_detail_tab_view_model.dart +++ b/khelo/lib/ui/flow/matches/match_detail/match_detail_tab_view_model.dart @@ -37,8 +37,8 @@ class MatchDetailTabViewNotifier extends StateNotifier { final InningsService _inningService; final BallScoreService _ballScoreService; late String _matchId; - late StreamSubscription matchStreamSubscription; - late StreamSubscription ballScoreStreamSubscription; + StreamSubscription? matchStreamSubscription; + StreamSubscription? ballScoreStreamSubscription; MatchDetailTabViewNotifier( this._matchService, @@ -62,30 +62,23 @@ class MatchDetailTabViewNotifier extends StateNotifier { final match = data.$1; final innings = data.$2; state = state.copyWith(match: match); - final firstInning = innings - .where((element) => - (state.match?.toss_decision == TossDecision.bat && - element.team_id == state.match?.toss_winner_id) || - (state.match?.toss_decision == TossDecision.bowl && - element.team_id != state.match?.toss_winner_id)) - .firstOrNull; - - final secondInning = innings - .where((element) => - (state.match?.toss_decision == TossDecision.bowl && - element.team_id == state.match?.toss_winner_id) || - (state.match?.toss_decision == TossDecision.bat && - element.team_id != state.match?.toss_winner_id)) - .firstOrNull; + // expand by default: winner team's last inning or currently running innings, all innings.first + final winnerInningId = innings + .where((element) => element.team_id == match.matchResult?.teamId) + .lastOrNull + ?.id; + final runningInningId = innings + .where((element) => element.innings_status == InningStatus.running) + .firstOrNull + ?.id; onScorecardExpansionChange( - match.matchResult?.teamId ?? match.current_playing_team_id ?? "", + winnerInningId ?? runningInningId ?? innings.firstOrNull?.id ?? '', true, ); state = state.copyWith( highlightTeamId: state.highlightTeamId ?? match.teams.first.team.id, - firstInning: firstInning, - secondInning: secondInning, + allInnings: innings, error: null); if (!state.ballScoreQueryListenerSet) { @@ -104,17 +97,16 @@ class MatchDetailTabViewNotifier extends StateNotifier { } void _loadBallScores() { - if (state.firstInning == null || state.secondInning == null) { + if (state.allInnings.isEmpty) { state = state.copyWith(loading: false); return; } state = state.copyWith(ballScoreQueryListenerSet: true); ballScoreStreamSubscription = _ballScoreService - .getBallScoresStreamByInningIds([ - state.firstInning?.id ?? "INVALID ID", - state.secondInning?.id ?? "INVALID ID" - ]).listen( + .getBallScoresStreamByInningIds( + state.allInnings.map((e) => e.id).toList()) + .listen( (scores) { final sortedList = scores.toList(); sortedList.sort((a, b) => a.ballScore.time.compareTo(b.ballScore.time)); @@ -230,9 +222,10 @@ class MatchDetailTabViewNotifier extends StateNotifier { } String _getTeamIdByInningId(String inningId) { - final teamId = state.firstInning?.id == inningId - ? state.firstInning?.team_id - : state.secondInning?.team_id; + final teamId = state.allInnings + .where((element) => element.id == inningId) + .firstOrNull + ?.team_id; return teamId ?? ""; } @@ -304,14 +297,15 @@ class MatchDetailTabViewNotifier extends StateNotifier { required String playerId, bool isFieldingTeam = false, }) { - final teamId = [state.firstInning, state.secondInning] - .where((element) => - isFieldingTeam ? element?.id != inningId : element?.id == inningId) + final teamId = state.allInnings + .where((element) => element.id == inningId) .firstOrNull ?.team_id; final player = state.match?.teams - .where((element) => teamId == element.team.id) + .where((element) => isFieldingTeam + ? teamId != element.team.id + : teamId == element.team.id) .firstOrNull ?.squad .where((element) => element.player.id == playerId) @@ -374,8 +368,8 @@ class MatchDetailTabViewNotifier extends StateNotifier { Future cancelStreamSubscription() async { state = state.copyWith(ballScoreQueryListenerSet: false); - await matchStreamSubscription.cancel(); - await ballScoreStreamSubscription.cancel(); + await matchStreamSubscription?.cancel(); + await ballScoreStreamSubscription?.cancel(); } void onTabChange(int tab) { @@ -384,15 +378,15 @@ class MatchDetailTabViewNotifier extends StateNotifier { } } - void onScorecardExpansionChange(String teamId, bool isExpanded) { - List expandedList = state.expandedTeamScorecard.toList(); + void onScorecardExpansionChange(String inningId, bool isExpanded) { + List expandedList = state.expandedInningsScorecard.toList(); if (isExpanded) { - expandedList.add(teamId); + expandedList.add(inningId); } else { - expandedList.remove(teamId); + expandedList.remove(inningId); } state = - state.copyWith(expandedTeamScorecard: expandedList.toSet().toList()); + state.copyWith(expandedInningsScorecard: expandedList.toSet().toList()); } Future onResume() async { @@ -412,15 +406,14 @@ class MatchDetailTabState with _$MatchDetailTabState { const factory MatchDetailTabState({ Object? error, MatchModel? match, - InningModel? firstInning, - InningModel? secondInning, + @Default([]) List allInnings, String? highlightTeamId, DateTime? showTeamSelectionSheet, DateTime? showHighlightOptionSelectionSheet, @Default(1) int selectedTab, @Default([]) List overList, @Default([]) List filteredHighlight, - @Default([]) List expandedTeamScorecard, + @Default([]) List expandedInningsScorecard, @Default(false) bool loading, @Default(false) bool ballScoreQueryListenerSet, @Default(HighlightFilterOption.all) diff --git a/khelo/lib/ui/flow/matches/match_detail/match_detail_tab_view_model.freezed.dart b/khelo/lib/ui/flow/matches/match_detail/match_detail_tab_view_model.freezed.dart index ab6fba05..a347b241 100644 --- a/khelo/lib/ui/flow/matches/match_detail/match_detail_tab_view_model.freezed.dart +++ b/khelo/lib/ui/flow/matches/match_detail/match_detail_tab_view_model.freezed.dart @@ -18,8 +18,7 @@ final _privateConstructorUsedError = UnsupportedError( mixin _$MatchDetailTabState { Object? get error => throw _privateConstructorUsedError; MatchModel? get match => throw _privateConstructorUsedError; - InningModel? get firstInning => throw _privateConstructorUsedError; - InningModel? get secondInning => throw _privateConstructorUsedError; + List get allInnings => throw _privateConstructorUsedError; String? get highlightTeamId => throw _privateConstructorUsedError; DateTime? get showTeamSelectionSheet => throw _privateConstructorUsedError; DateTime? get showHighlightOptionSelectionSheet => @@ -27,7 +26,8 @@ mixin _$MatchDetailTabState { int get selectedTab => throw _privateConstructorUsedError; List get overList => throw _privateConstructorUsedError; List get filteredHighlight => throw _privateConstructorUsedError; - List get expandedTeamScorecard => throw _privateConstructorUsedError; + List get expandedInningsScorecard => + throw _privateConstructorUsedError; bool get loading => throw _privateConstructorUsedError; bool get ballScoreQueryListenerSet => throw _privateConstructorUsedError; HighlightFilterOption get highlightFilterOption => @@ -47,22 +47,19 @@ abstract class $MatchDetailTabStateCopyWith<$Res> { $Res call( {Object? error, MatchModel? match, - InningModel? firstInning, - InningModel? secondInning, + List allInnings, String? highlightTeamId, DateTime? showTeamSelectionSheet, DateTime? showHighlightOptionSelectionSheet, int selectedTab, List overList, List filteredHighlight, - List expandedTeamScorecard, + List expandedInningsScorecard, bool loading, bool ballScoreQueryListenerSet, HighlightFilterOption highlightFilterOption}); $MatchModelCopyWith<$Res>? get match; - $InningModelCopyWith<$Res>? get firstInning; - $InningModelCopyWith<$Res>? get secondInning; } /// @nodoc @@ -80,15 +77,14 @@ class _$MatchDetailTabStateCopyWithImpl<$Res, $Val extends MatchDetailTabState> $Res call({ Object? error = freezed, Object? match = freezed, - Object? firstInning = freezed, - Object? secondInning = freezed, + Object? allInnings = null, Object? highlightTeamId = freezed, Object? showTeamSelectionSheet = freezed, Object? showHighlightOptionSelectionSheet = freezed, Object? selectedTab = null, Object? overList = null, Object? filteredHighlight = null, - Object? expandedTeamScorecard = null, + Object? expandedInningsScorecard = null, Object? loading = null, Object? ballScoreQueryListenerSet = null, Object? highlightFilterOption = null, @@ -99,14 +95,10 @@ class _$MatchDetailTabStateCopyWithImpl<$Res, $Val extends MatchDetailTabState> ? _value.match : match // ignore: cast_nullable_to_non_nullable as MatchModel?, - firstInning: freezed == firstInning - ? _value.firstInning - : firstInning // ignore: cast_nullable_to_non_nullable - as InningModel?, - secondInning: freezed == secondInning - ? _value.secondInning - : secondInning // ignore: cast_nullable_to_non_nullable - as InningModel?, + allInnings: null == allInnings + ? _value.allInnings + : allInnings // ignore: cast_nullable_to_non_nullable + as List, highlightTeamId: freezed == highlightTeamId ? _value.highlightTeamId : highlightTeamId // ignore: cast_nullable_to_non_nullable @@ -132,9 +124,9 @@ class _$MatchDetailTabStateCopyWithImpl<$Res, $Val extends MatchDetailTabState> ? _value.filteredHighlight : filteredHighlight // ignore: cast_nullable_to_non_nullable as List, - expandedTeamScorecard: null == expandedTeamScorecard - ? _value.expandedTeamScorecard - : expandedTeamScorecard // ignore: cast_nullable_to_non_nullable + expandedInningsScorecard: null == expandedInningsScorecard + ? _value.expandedInningsScorecard + : expandedInningsScorecard // ignore: cast_nullable_to_non_nullable as List, loading: null == loading ? _value.loading @@ -162,30 +154,6 @@ class _$MatchDetailTabStateCopyWithImpl<$Res, $Val extends MatchDetailTabState> return _then(_value.copyWith(match: value) as $Val); }); } - - @override - @pragma('vm:prefer-inline') - $InningModelCopyWith<$Res>? get firstInning { - if (_value.firstInning == null) { - return null; - } - - return $InningModelCopyWith<$Res>(_value.firstInning!, (value) { - return _then(_value.copyWith(firstInning: value) as $Val); - }); - } - - @override - @pragma('vm:prefer-inline') - $InningModelCopyWith<$Res>? get secondInning { - if (_value.secondInning == null) { - return null; - } - - return $InningModelCopyWith<$Res>(_value.secondInning!, (value) { - return _then(_value.copyWith(secondInning: value) as $Val); - }); - } } /// @nodoc @@ -199,25 +167,20 @@ abstract class _$$MatchDetailTabStateImplCopyWith<$Res> $Res call( {Object? error, MatchModel? match, - InningModel? firstInning, - InningModel? secondInning, + List allInnings, String? highlightTeamId, DateTime? showTeamSelectionSheet, DateTime? showHighlightOptionSelectionSheet, int selectedTab, List overList, List filteredHighlight, - List expandedTeamScorecard, + List expandedInningsScorecard, bool loading, bool ballScoreQueryListenerSet, HighlightFilterOption highlightFilterOption}); @override $MatchModelCopyWith<$Res>? get match; - @override - $InningModelCopyWith<$Res>? get firstInning; - @override - $InningModelCopyWith<$Res>? get secondInning; } /// @nodoc @@ -233,15 +196,14 @@ class __$$MatchDetailTabStateImplCopyWithImpl<$Res> $Res call({ Object? error = freezed, Object? match = freezed, - Object? firstInning = freezed, - Object? secondInning = freezed, + Object? allInnings = null, Object? highlightTeamId = freezed, Object? showTeamSelectionSheet = freezed, Object? showHighlightOptionSelectionSheet = freezed, Object? selectedTab = null, Object? overList = null, Object? filteredHighlight = null, - Object? expandedTeamScorecard = null, + Object? expandedInningsScorecard = null, Object? loading = null, Object? ballScoreQueryListenerSet = null, Object? highlightFilterOption = null, @@ -252,14 +214,10 @@ class __$$MatchDetailTabStateImplCopyWithImpl<$Res> ? _value.match : match // ignore: cast_nullable_to_non_nullable as MatchModel?, - firstInning: freezed == firstInning - ? _value.firstInning - : firstInning // ignore: cast_nullable_to_non_nullable - as InningModel?, - secondInning: freezed == secondInning - ? _value.secondInning - : secondInning // ignore: cast_nullable_to_non_nullable - as InningModel?, + allInnings: null == allInnings + ? _value._allInnings + : allInnings // ignore: cast_nullable_to_non_nullable + as List, highlightTeamId: freezed == highlightTeamId ? _value.highlightTeamId : highlightTeamId // ignore: cast_nullable_to_non_nullable @@ -285,9 +243,9 @@ class __$$MatchDetailTabStateImplCopyWithImpl<$Res> ? _value._filteredHighlight : filteredHighlight // ignore: cast_nullable_to_non_nullable as List, - expandedTeamScorecard: null == expandedTeamScorecard - ? _value._expandedTeamScorecard - : expandedTeamScorecard // ignore: cast_nullable_to_non_nullable + expandedInningsScorecard: null == expandedInningsScorecard + ? _value._expandedInningsScorecard + : expandedInningsScorecard // ignore: cast_nullable_to_non_nullable as List, loading: null == loading ? _value.loading @@ -311,30 +269,35 @@ class _$MatchDetailTabStateImpl implements _MatchDetailTabState { const _$MatchDetailTabStateImpl( {this.error, this.match, - this.firstInning, - this.secondInning, + final List allInnings = const [], this.highlightTeamId, this.showTeamSelectionSheet, this.showHighlightOptionSelectionSheet, this.selectedTab = 1, final List overList = const [], final List filteredHighlight = const [], - final List expandedTeamScorecard = const [], + final List expandedInningsScorecard = const [], this.loading = false, this.ballScoreQueryListenerSet = false, this.highlightFilterOption = HighlightFilterOption.all}) - : _overList = overList, + : _allInnings = allInnings, + _overList = overList, _filteredHighlight = filteredHighlight, - _expandedTeamScorecard = expandedTeamScorecard; + _expandedInningsScorecard = expandedInningsScorecard; @override final Object? error; @override final MatchModel? match; + final List _allInnings; @override - final InningModel? firstInning; - @override - final InningModel? secondInning; + @JsonKey() + List get allInnings { + if (_allInnings is EqualUnmodifiableListView) return _allInnings; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_allInnings); + } + @override final String? highlightTeamId; @override @@ -363,14 +326,14 @@ class _$MatchDetailTabStateImpl implements _MatchDetailTabState { return EqualUnmodifiableListView(_filteredHighlight); } - final List _expandedTeamScorecard; + final List _expandedInningsScorecard; @override @JsonKey() - List get expandedTeamScorecard { - if (_expandedTeamScorecard is EqualUnmodifiableListView) - return _expandedTeamScorecard; + List get expandedInningsScorecard { + if (_expandedInningsScorecard is EqualUnmodifiableListView) + return _expandedInningsScorecard; // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(_expandedTeamScorecard); + return EqualUnmodifiableListView(_expandedInningsScorecard); } @override @@ -385,7 +348,7 @@ class _$MatchDetailTabStateImpl implements _MatchDetailTabState { @override String toString() { - return 'MatchDetailTabState(error: $error, match: $match, firstInning: $firstInning, secondInning: $secondInning, highlightTeamId: $highlightTeamId, showTeamSelectionSheet: $showTeamSelectionSheet, showHighlightOptionSelectionSheet: $showHighlightOptionSelectionSheet, selectedTab: $selectedTab, overList: $overList, filteredHighlight: $filteredHighlight, expandedTeamScorecard: $expandedTeamScorecard, loading: $loading, ballScoreQueryListenerSet: $ballScoreQueryListenerSet, highlightFilterOption: $highlightFilterOption)'; + return 'MatchDetailTabState(error: $error, match: $match, allInnings: $allInnings, highlightTeamId: $highlightTeamId, showTeamSelectionSheet: $showTeamSelectionSheet, showHighlightOptionSelectionSheet: $showHighlightOptionSelectionSheet, selectedTab: $selectedTab, overList: $overList, filteredHighlight: $filteredHighlight, expandedInningsScorecard: $expandedInningsScorecard, loading: $loading, ballScoreQueryListenerSet: $ballScoreQueryListenerSet, highlightFilterOption: $highlightFilterOption)'; } @override @@ -395,10 +358,8 @@ class _$MatchDetailTabStateImpl implements _MatchDetailTabState { other is _$MatchDetailTabStateImpl && const DeepCollectionEquality().equals(other.error, error) && (identical(other.match, match) || other.match == match) && - (identical(other.firstInning, firstInning) || - other.firstInning == firstInning) && - (identical(other.secondInning, secondInning) || - other.secondInning == secondInning) && + const DeepCollectionEquality() + .equals(other._allInnings, _allInnings) && (identical(other.highlightTeamId, highlightTeamId) || other.highlightTeamId == highlightTeamId) && (identical(other.showTeamSelectionSheet, showTeamSelectionSheet) || @@ -412,8 +373,8 @@ class _$MatchDetailTabStateImpl implements _MatchDetailTabState { const DeepCollectionEquality().equals(other._overList, _overList) && const DeepCollectionEquality() .equals(other._filteredHighlight, _filteredHighlight) && - const DeepCollectionEquality() - .equals(other._expandedTeamScorecard, _expandedTeamScorecard) && + const DeepCollectionEquality().equals( + other._expandedInningsScorecard, _expandedInningsScorecard) && (identical(other.loading, loading) || other.loading == loading) && (identical(other.ballScoreQueryListenerSet, ballScoreQueryListenerSet) || @@ -427,15 +388,14 @@ class _$MatchDetailTabStateImpl implements _MatchDetailTabState { runtimeType, const DeepCollectionEquality().hash(error), match, - firstInning, - secondInning, + const DeepCollectionEquality().hash(_allInnings), highlightTeamId, showTeamSelectionSheet, showHighlightOptionSelectionSheet, selectedTab, const DeepCollectionEquality().hash(_overList), const DeepCollectionEquality().hash(_filteredHighlight), - const DeepCollectionEquality().hash(_expandedTeamScorecard), + const DeepCollectionEquality().hash(_expandedInningsScorecard), loading, ballScoreQueryListenerSet, highlightFilterOption); @@ -452,15 +412,14 @@ abstract class _MatchDetailTabState implements MatchDetailTabState { const factory _MatchDetailTabState( {final Object? error, final MatchModel? match, - final InningModel? firstInning, - final InningModel? secondInning, + final List allInnings, final String? highlightTeamId, final DateTime? showTeamSelectionSheet, final DateTime? showHighlightOptionSelectionSheet, final int selectedTab, final List overList, final List filteredHighlight, - final List expandedTeamScorecard, + final List expandedInningsScorecard, final bool loading, final bool ballScoreQueryListenerSet, final HighlightFilterOption highlightFilterOption}) = @@ -471,9 +430,7 @@ abstract class _MatchDetailTabState implements MatchDetailTabState { @override MatchModel? get match; @override - InningModel? get firstInning; - @override - InningModel? get secondInning; + List get allInnings; @override String? get highlightTeamId; @override @@ -487,7 +444,7 @@ abstract class _MatchDetailTabState implements MatchDetailTabState { @override List get filteredHighlight; @override - List get expandedTeamScorecard; + List get expandedInningsScorecard; @override bool get loading; @override diff --git a/khelo/lib/ui/flow/matches/match_list_screen.dart b/khelo/lib/ui/flow/matches/match_list_screen.dart index 2a1b0b96..65e5240f 100644 --- a/khelo/lib/ui/flow/matches/match_list_screen.dart +++ b/khelo/lib/ui/flow/matches/match_list_screen.dart @@ -77,7 +77,7 @@ class _MatchListScreenState extends ConsumerState onActionTap: () { if (match.match_status == MatchStatus.yetToStart) { AppRoute.addMatch(matchId: match.id).push(context); - } else { + } else if (match.match_status == MatchStatus.running) { if (match.toss_decision == null || match.toss_winner_id == null) { AppRoute.addTossDetail(matchId: match.id ?? "INVALID_ID") diff --git a/khelo/lib/ui/flow/score_board/components/match_complete_sheet.dart b/khelo/lib/ui/flow/score_board/components/match_complete_sheet.dart index b071617f..fcf51092 100644 --- a/khelo/lib/ui/flow/score_board/components/match_complete_sheet.dart +++ b/khelo/lib/ui/flow/score_board/components/match_complete_sheet.dart @@ -17,8 +17,6 @@ class MatchCompleteSheet extends ConsumerWidget { static Future show( BuildContext context, { bool showUndoButton = true, - required TeamRunStat firstTeamRunStat, - required TeamRunStat secondTeamRunStat, }) { HapticFeedback.mediumImpact(); return showModalBottomSheet( @@ -32,22 +30,14 @@ class MatchCompleteSheet extends ConsumerWidget { builder: (context) { return MatchCompleteSheet( showUndoButton: showUndoButton, - firstTeamRunStat: firstTeamRunStat, - secondTeamRunStat: secondTeamRunStat, ); }, ); } final bool showUndoButton; - final TeamRunStat firstTeamRunStat; - final TeamRunStat secondTeamRunStat; - const MatchCompleteSheet( - {super.key, - required this.showUndoButton, - required this.firstTeamRunStat, - required this.secondTeamRunStat}); + const MatchCompleteSheet({super.key, required this.showUndoButton}); @override Widget build(BuildContext context, WidgetRef ref) { @@ -91,8 +81,11 @@ class MatchCompleteSheet extends ConsumerWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ + // passing match_status as finish because matchResult is calculated based on match_status. WonByMessageText( - matchResult: state.match?.matchResult, + matchResult: state.match + ?.copyWith(match_status: MatchStatus.finish) + .matchResult, textStyle: AppTextStyle.subtitle2 .copyWith(color: context.colorScheme.textPrimary)), const SizedBox(height: 16), @@ -120,13 +113,22 @@ class MatchCompleteSheet extends ConsumerWidget { data2: context.l10n.score_board_o_title, isHeader: true, ), - _teamScore(context, state, teamRunStat: firstTeamRunStat), - _teamScore( - context, - state, - teamRunStat: secondTeamRunStat, - isLast: true, - ) + ...state.allInnings.map( + (inning) { + final teamName = state.match?.teams + .where((element) => element.team.id == inning.team_id) + .firstOrNull + ?.team + .name; + return _teamScore(context, state, + teamRunStat: TeamRunStat( + teamName: teamName ?? '', + wicket: inning.total_wickets, + run: inning.total_runs, + over: inning.overs), + isLast: inning.id == state.allInnings.last.id); + }, + ), ], ), ); @@ -164,10 +166,7 @@ class MatchCompleteSheet extends ConsumerWidget { color: isHeader ? context.colorScheme.containerLow : context.colorScheme.surface, - border: Border( - top: isLast - ? BorderSide(color: context.colorScheme.outline) - : BorderSide.none), + border: Border(top: BorderSide(color: context.colorScheme.outline)), borderRadius: BorderRadius.vertical( top: Radius.circular(isHeader ? 8 : 0), bottom: Radius.circular(isLast ? 8 : 0))), diff --git a/khelo/lib/ui/flow/score_board/components/score_display_view.dart b/khelo/lib/ui/flow/score_board/components/score_display_view.dart index 0478c81f..53d94e5e 100644 --- a/khelo/lib/ui/flow/score_board/components/score_display_view.dart +++ b/khelo/lib/ui/flow/score_board/components/score_display_view.dart @@ -1,5 +1,4 @@ import 'package:data/api/ball_score/ball_score_model.dart'; -import 'package:data/api/innings/inning_model.dart'; import 'package:data/api/match/match_model.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; @@ -42,11 +41,16 @@ class ScoreDisplayView extends ConsumerWidget { } Widget _teamName( - BuildContext context, - bool batting, - ) { + BuildContext context, { + required bool isBatting, + String? inningString, + }) { + final teamName = isBatting + ? (battingTeamName ?? "") + + (inningString != null ? " - $inningString" : "") + : bowlingTeamName ?? ""; return Text( - (batting ? battingTeamName : bowlingTeamName) ?? "", + teamName, maxLines: 2, overflow: TextOverflow.ellipsis, style: AppTextStyle.subtitle1 @@ -58,6 +62,12 @@ class ScoreDisplayView extends ConsumerWidget { BuildContext context, ScoreBoardViewState state, ) { + final inningString = state.match?.match_type == MatchType.testMatch + ? (state.currentInning?.index == 1 || state.currentInning?.index == 2) + ? context.l10n.common_first_inning_title + : context.l10n.common_second_inning_title + : null; + return Container( padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 16), margin: const EdgeInsets.symmetric(horizontal: 16), @@ -67,7 +77,7 @@ class ScoreDisplayView extends ConsumerWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - _teamName(context, true), + _teamName(context, isBatting: true, inningString: inningString), const SizedBox(height: 12), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, @@ -132,15 +142,17 @@ class ScoreDisplayView extends ConsumerWidget { BuildContext context, ScoreBoardViewState state, ) { - if (state.otherInning?.innings_status == InningStatus.finish) { - final requiredRun = ((state.otherInning?.total_runs ?? 0) + 1) - - (state.currentInning?.total_runs ?? 0); + if (state.nextInning == null) { + final requiredRun = getRequiredRun(state); final pendingOver = (state.match?.number_of_over ?? 0) - state.overCount; final pendingBall = (pendingOver * 6) + (6 - state.ballCount); return Text( - context.l10n.score_board_need_run_text( - requiredRun < 0 ? 0 : requiredRun, - pendingBall < 0 ? 0 : pendingBall), + state.match?.match_type == MatchType.testMatch + ? context.l10n + .score_board_need_run_text(requiredRun < 0 ? 0 : requiredRun) + : context.l10n.score_board_run_need_in_ball_text( + requiredRun < 0 ? 0 : requiredRun, + pendingBall < 0 ? 0 : pendingBall), textAlign: TextAlign.center, style: AppTextStyle.caption.copyWith(color: context.colorScheme.secondary), @@ -150,6 +162,17 @@ class ScoreDisplayView extends ConsumerWidget { } } + int getRequiredRun(ScoreBoardViewState state) { + final currentPlayingTeam = state.match?.teams + .where((element) => element.team.id == state.currentInning?.team_id) + .firstOrNull; + final otherTeam = state.match?.teams + .where((element) => element.team.id != currentPlayingTeam?.team.id) + .firstOrNull; + + return ((otherTeam?.run ?? 0) + 1) - (currentPlayingTeam?.run ?? 0); + } + Widget _batsManDetailsView(BuildContext context, ScoreBoardViewState state) { return Padding( padding: const EdgeInsets.symmetric(horizontal: 16.0), @@ -247,7 +270,7 @@ class ScoreDisplayView extends ConsumerWidget { children: [ Padding( padding: const EdgeInsets.symmetric(horizontal: 16), - child: _teamName(context, false), + child: _teamName(context, isBatting: false), ), const SizedBox(height: 8), _bowlerNameView( diff --git a/khelo/lib/ui/flow/score_board/components/select_player_sheet.dart b/khelo/lib/ui/flow/score_board/components/select_player_sheet.dart index 70f9de1f..7cac004a 100644 --- a/khelo/lib/ui/flow/score_board/components/select_player_sheet.dart +++ b/khelo/lib/ui/flow/score_board/components/select_player_sheet.dart @@ -19,8 +19,6 @@ class SelectPlayerSheet extends ConsumerStatefulWidget { BuildContext context, { required PlayerSelectionType type, required bool continueWithInjPlayer, - required List batsManList, - required List bowlerList, }) { HapticFeedback.mediumImpact(); return showModalBottomSheet( @@ -35,8 +33,6 @@ class SelectPlayerSheet extends ConsumerStatefulWidget { return SelectPlayerSheet( playerSelectionType: type, continueWithInjPlayer: continueWithInjPlayer, - batsManList: batsManList, - bowlerList: bowlerList, ); }, ); @@ -44,15 +40,11 @@ class SelectPlayerSheet extends ConsumerStatefulWidget { final PlayerSelectionType playerSelectionType; final bool continueWithInjPlayer; - final List batsManList; - final List bowlerList; const SelectPlayerSheet({ super.key, required this.playerSelectionType, required this.continueWithInjPlayer, - required this.batsManList, - required this.bowlerList, }); @override @@ -64,38 +56,51 @@ class _SelectPlayerSheetState extends ConsumerState { MatchPlayer? batsMan2; MatchPlayer? bowler; bool isEnabled = false; + late List batsManList; + late List bowlerList; + late ScoreBoardViewNotifier notifier; @override void initState() { super.initState(); + notifier = ref.read(scoreBoardStateProvider.notifier); isEnabled = widget.continueWithInjPlayer; + + batsManList = notifier.getFilteredPlayerList(PlayerSelectionType.batsMan); + bowlerList = notifier.getFilteredPlayerList(PlayerSelectionType.bowler); } @override Widget build(BuildContext context) { final state = ref.watch(scoreBoardStateProvider); - final notifier = ref.watch(scoreBoardStateProvider.notifier); final showCheckBox = widget.playerSelectionType != PlayerSelectionType.bowler - ? widget.batsManList - .any((element) => element.status == PlayerStatus.injured) + ? batsManList.any((element) => element.performance.any( + (element) => + element.inning_id == state.currentInning?.id && + element.status == PlayerStatus.injured, + )) : false; final injuredPlayerRemained = widget.playerSelectionType != PlayerSelectionType.bowler - ? widget.batsManList.every((e) => e.status == PlayerStatus.injured) + ? batsManList.every((e) => e.performance.any( + (element) => + element.inning_id == state.currentInning?.id && + element.status == PlayerStatus.injured, + )) : false; return BottomSheetWrapper( content: _selectPlayerContent( context, state, - batsManList: widget.batsManList, - bowlerList: widget.bowlerList, + batsManList: batsManList, + bowlerList: bowlerList, ), options: [ if (showCheckBox) ...[ - _contWithInjPlayerOption(context, notifier), + _contWithInjPlayerOption(context, notifier, state), const SizedBox(height: 16) ], ], @@ -172,51 +177,60 @@ class _SelectPlayerSheetState extends ConsumerState { return Wrap( spacing: 16, runSpacing: 16, - children: [ - for (final player in list) ...[ - UserCellView( - title: player.player.name ?? context.l10n.common_anonymous_title, - imageUrl: player.player.profile_img_url, - initial: player.player.nameInitial, - subtitle: showOverCount - ? "(${context.l10n.match_list_overs_title(_getOverCount(state, player.player.id))})" - : null, - isSelected: type == PlayerSelectionType.batsMan - ? [batsMan1?.player.id, batsMan2?.player.id] - .contains(player.player.id) - : bowler?.player.id == player.player.id, - tag: player.status == PlayerStatus.injured && - type == PlayerSelectionType.batsMan - ? context.l10n.score_board_injured_tag_title - : null, - disableCell: player.status == PlayerStatus.injured && - type == PlayerSelectionType.batsMan && - !isEnabled, - onTap: () => setState(() { - if (type == PlayerSelectionType.batsMan) { - if (widget.playerSelectionType == PlayerSelectionType.all) { - if (batsMan1?.player.id == player.player.id) { - batsMan1 = null; - } else if (batsMan2?.player.id == player.player.id) { - batsMan2 = null; - } else if (batsMan1 == null) { - batsMan1 = player; - } else if (batsMan2 == null) { - batsMan2 = player; - } else { - return; - // extra else to suppress lint suggestion of using ??= for batsMan2 assignment - } - } else { + children: list.map((player) { + final status = player.performance + .where((element) => element.inning_id == state.currentInning?.id) + .firstOrNull + ?.status; + + final isSelected = type == PlayerSelectionType.batsMan + ? [batsMan1?.player.id, batsMan2?.player.id] + .contains(player.player.id) + : bowler?.player.id == player.player.id; + + final tag = status == PlayerStatus.injured && + type == PlayerSelectionType.batsMan + ? context.l10n.score_board_injured_tag_title + : null; + + final disableCell = status == PlayerStatus.injured && + type == PlayerSelectionType.batsMan && + !isEnabled; + + return UserCellView( + title: player.player.name ?? context.l10n.common_anonymous_title, + imageUrl: player.player.profile_img_url, + initial: player.player.nameInitial, + subtitle: showOverCount + ? "(${context.l10n.match_list_overs_title(_getOverCount(state, player.player.id))})" + : null, + isSelected: isSelected, + tag: tag, + disableCell: disableCell, + onTap: () => setState(() { + if (type == PlayerSelectionType.batsMan) { + if (widget.playerSelectionType == PlayerSelectionType.all) { + if (batsMan1?.player.id == player.player.id) { + batsMan1 = null; + } else if (batsMan2?.player.id == player.player.id) { + batsMan2 = null; + } else if (batsMan1 == null) { batsMan1 = player; + } else if (batsMan2 == null) { + batsMan2 = player; + } else { + return; + // extra else to suppress lint suggestion of using ??= for batsMan2 assignment } } else { - bowler = player; + batsMan1 = player; } - }), - ) - ], - ], + } else { + bowler = player; + } + }), + ); + }).toList(), ); } @@ -248,7 +262,10 @@ class _SelectPlayerSheetState extends ConsumerState { } Widget _contWithInjPlayerOption( - BuildContext context, ScoreBoardViewNotifier notifier) { + BuildContext context, + ScoreBoardViewNotifier notifier, + ScoreBoardViewState state, + ) { return ToggleButtonTile( title: context.l10n.score_board_continue_with_injured_player_title, defaultEnabled: isEnabled, @@ -256,10 +273,20 @@ class _SelectPlayerSheetState extends ConsumerState { isEnabled = !isEnabled; notifier.onContinueWithInjuredPlayersChange(isEnabled); if (!isEnabled) { - if (batsMan1?.status == PlayerStatus.injured) { + if (batsMan1?.performance + .where( + (element) => element.inning_id == state.currentInning?.id) + .firstOrNull + ?.status == + PlayerStatus.injured) { batsMan1 = null; } - if (batsMan2?.status == PlayerStatus.injured) { + if (batsMan2?.performance + .where( + (element) => element.inning_id == state.currentInning?.id) + .firstOrNull + ?.status == + PlayerStatus.injured) { batsMan2 = null; } } diff --git a/khelo/lib/ui/flow/score_board/components/user_cell_view.dart b/khelo/lib/ui/flow/score_board/components/user_cell_view.dart index aed42196..a1e93965 100644 --- a/khelo/lib/ui/flow/score_board/components/user_cell_view.dart +++ b/khelo/lib/ui/flow/score_board/components/user_cell_view.dart @@ -71,6 +71,7 @@ class UserCellView extends StatelessWidget { Text( title, maxLines: 2, + textAlign: TextAlign.center, overflow: TextOverflow.ellipsis, style: AppTextStyle.subtitle1 .copyWith(color: context.colorScheme.textPrimary), @@ -78,6 +79,7 @@ class UserCellView extends StatelessWidget { if (subtitle != null) ...[ Text( subtitle!, + textAlign: TextAlign.center, style: AppTextStyle.body1 .copyWith(color: context.colorScheme.textDisabled), ) @@ -85,6 +87,7 @@ class UserCellView extends StatelessWidget { if (tag != null) ...[ Text( tag!, + textAlign: TextAlign.center, style: AppTextStyle.body1 .copyWith(color: context.colorScheme.alert), ), diff --git a/khelo/lib/ui/flow/score_board/score_board_screen.dart b/khelo/lib/ui/flow/score_board/score_board_screen.dart index bb6f1003..575f54ae 100644 --- a/khelo/lib/ui/flow/score_board/score_board_screen.dart +++ b/khelo/lib/ui/flow/score_board/score_board_screen.dart @@ -157,8 +157,6 @@ class _ScoreBoardScreenState extends ConsumerState { context, type: type, continueWithInjPlayer: continueWithInjuredPlayers, - batsManList: notifier.getFilteredPlayerList(PlayerSelectionType.batsMan), - bowlerList: notifier.getFilteredPlayerList(PlayerSelectionType.bowler), ); if (result != null && context.mounted) { if (result.selectedPlayer != null) { @@ -249,11 +247,7 @@ class _ScoreBoardScreenState extends ConsumerState { } Future _showMatchCompleteSheet(BuildContext context) async { - final endMatch = await MatchCompleteSheet.show( - context, - firstTeamRunStat: notifier.getTeamRunDetails(true), - secondTeamRunStat: notifier.getTeamRunDetails(false), - ); + final endMatch = await MatchCompleteSheet.show(context); if (endMatch != null && context.mounted) { if (endMatch) { notifier.endMatch(); diff --git a/khelo/lib/ui/flow/score_board/score_board_view_model.dart b/khelo/lib/ui/flow/score_board/score_board_view_model.dart index 4d77f482..926e624e 100644 --- a/khelo/lib/ui/flow/score_board/score_board_view_model.dart +++ b/khelo/lib/ui/flow/score_board/score_board_view_model.dart @@ -4,6 +4,7 @@ import 'package:data/api/match/match_model.dart'; import 'package:data/api/innings/inning_model.dart'; import 'package:data/api/ball_score/ball_score_model.dart'; import 'package:data/errors/app_error.dart'; +import 'package:data/extensions/list_extensions.dart'; import 'package:data/service/match/match_service.dart'; import 'package:data/service/innings/inning_service.dart'; import 'package:data/service/ball_score/ball_score_service.dart'; @@ -29,10 +30,10 @@ class ScoreBoardViewNotifier extends StateNotifier { final MatchService _matchService; final InningsService _inningService; final BallScoreService _ballScoreService; - late StreamSubscription _matchStreamSubscription; - late StreamSubscription>? _ballScoreStreamSubscription; + StreamSubscription? _matchStreamSubscription; + StreamSubscription>? _ballScoreStreamSubscription; final StreamController _matchStreamController = - StreamController(); + StreamController.broadcast(); String? matchId; ScoreBoardViewNotifier( @@ -63,43 +64,62 @@ class ScoreBoardViewNotifier extends StateNotifier { _matchService.getMatchStreamById(matchId!), _inningService.getInningsStreamByMatchId(matchId: matchId!), ).asyncMap((data) async { - try { - MatchModel match = data.$1; - List innings = data.$2; - final previousMatch = state.match; - final isMatchChanged = state.match != match; - state = state.copyWith(match: match, error: null); - if (innings.isEmpty) { - await _createInnings(); - } else { - final inningFirst = innings - .where( - (element) => element.innings_status == InningStatus.running) + MatchModel match = data.$1; + List innings = data.$2; + final previousMatch = state.match; + final isMatchChanged = state.match != match; + final isInningChanged = state.allInnings.isEmpty && innings.isNotEmpty; + state = state.copyWith(match: match, error: null); + if (innings.isEmpty) { + await _createInnings( + isForTestMatch: match.match_type == MatchType.testMatch); + } else { + final inningFirst = innings + .where( + (element) => element.innings_status == InningStatus.running) + .firstOrNull; + InningModel? inningSecond; + InningModel? nextInning; + if (match.match_type == MatchType.testMatch) { + final isIndexEven = (inningFirst?.index ?? 0) % 2 == 0; + inningSecond = innings + .where((inning) => _isSelectInning( + inning, isIndexEven, inningFirst?.index ?? 0)) .firstOrNull; - - final inningSecond = innings + } else { + inningSecond = innings .where( (element) => element.innings_status != InningStatus.running) .firstOrNull; - if (inningFirst != state.currentInning || - inningSecond != state.otherInning) { - state = state.copyWith( - currentInning: inningFirst, - otherInning: inningSecond, - error: null); - } } - if (isMatchChanged) { - final previousIsMatchUpdatedState = state.isMatchUpdated; - _configureCurrentBatsmen(); - if (!previousIsMatchUpdatedState || previousMatch == null) { - // return match only if first time loading or change occur due to add or undo - return match; - } + nextInning = innings + .where( + (inning) => inning.index == (inningFirst?.index ?? 0) + 1, + ) + .firstOrNull; + + if (inningFirst != state.currentInning || + inningSecond != state.otherInning || + nextInning != state.nextInning) { + state = state.copyWith( + allInnings: innings, + currentInning: inningFirst, + otherInning: inningSecond, + nextInning: nextInning, + error: null); + } + } + + if (isMatchChanged || isInningChanged) { + final previousIsMatchUpdatedState = state.isMatchUpdated; + _configureCurrentBatsmen(); + if (!previousIsMatchUpdatedState || + previousMatch == null || + isInningChanged) { + // return match only if first time loading or change occur due to add or undo or got innings + return match; } - } catch (e) { - throw AppError.fromError(e); } }); _matchStreamSubscription = matchInningStream.listen((matchStream) { @@ -109,10 +129,10 @@ class ScoreBoardViewNotifier extends StateNotifier { if (matchStream is MatchModel) { _matchStreamController.add(matchStream); } - }, onError: (e) { + }, onError: (e, stack) { debugPrint( - "ScoreBoardViewNotifier: error while loading match and inning -> $e"); - _matchStreamController.addError(e); + "ScoreBoardViewNotifier: error while loading match and inning -> $e, \nstack: $stack"); + _matchStreamController.addError(AppError.fromError(e)); state = state.copyWith( error: AppError.fromError(e), loading: false, @@ -128,12 +148,24 @@ class ScoreBoardViewNotifier extends StateNotifier { } } + bool _isSelectInning( + InningModel inning, + bool isIndexEven, + int firstInningIndex, + ) { + final index = isIndexEven ? firstInningIndex - 1 : firstInningIndex + 1; + return inning.innings_status != InningStatus.running && + index == inning.index; + } + void _loadBallScore() { final currentInningId = state.currentInning?.id; final otherInningId = state.otherInning?.id; if (currentInningId == null || otherInningId == null) { return; } + + _ballScoreStreamSubscription?.cancel(); try { state = state.copyWith(ballScoreQueryListenerSet: true); final ballScoreStream = combineLatest2(_matchStreamController.stream, @@ -216,19 +248,29 @@ class ScoreBoardViewNotifier extends StateNotifier { return; } - final battingTeamSquad = state.match!.teams + final List? battingTeamSquad = state.match!.teams .where((element) => state.match!.current_playing_team_id == element.team.id) .firstOrNull ?.squad; final currentPlayingBatsMan = battingTeamSquad - ?.where((element) => element.status == PlayerStatus.playing) + ?.where((element) => element.performance.any((element) => + element.status == PlayerStatus.playing && + element.inning_id == state.currentInning?.id)) .toList(); - int lastPlayerIndex = battingTeamSquad?.map((e) => e.index).reduce( - (value, element) => + int lastPlayerIndex = battingTeamSquad + ?.map( + (e) => e.performance + .where( + (element) => element.inning_id == state.currentInning?.id) + .firstOrNull + ?.index, + ) + .reduce((value, element) => (value ?? 0) > (element ?? 0) ? value ?? 0 : element ?? 0) ?? 0; + state = state.copyWith( batsMans: currentPlayingBatsMan, lastAssignedIndex: lastPlayerIndex, @@ -341,7 +383,9 @@ class ScoreBoardViewNotifier extends StateNotifier { } } - Future _createInnings() async { + Future _createInnings({ + bool isForTestMatch = false, + }) async { final matchId = state.match?.id; final tossWinnerId = state.match?.toss_winner_id; final tossDecision = state.match?.toss_decision; @@ -358,16 +402,42 @@ class ScoreBoardViewNotifier extends StateNotifier { } try { - await _inningService.createInnings( - matchId: matchId, - teamId: tossWinnerId, - firstInningStatus: tossDecision == TossDecision.bat - ? InningStatus.running - : InningStatus.yetToStart, - opponentTeamId: opponentTeamId, - secondInningStatus: tossDecision == TossDecision.bat - ? InningStatus.yetToStart - : InningStatus.running); + final List innings = []; + innings.add(InningModel( + id: _inningService.generateInningId, + match_id: matchId, + team_id: tossWinnerId, + index: tossDecision == TossDecision.bat ? 1 : 2, + innings_status: tossDecision == TossDecision.bat + ? InningStatus.running + : InningStatus.yetToStart, + )); + innings.add(InningModel( + id: _inningService.generateInningId, + match_id: matchId, + team_id: opponentTeamId, + index: tossDecision == TossDecision.bat ? 2 : 1, + innings_status: tossDecision == TossDecision.bat + ? InningStatus.yetToStart + : InningStatus.running, + )); + if (isForTestMatch) { + innings.add(InningModel( + id: _inningService.generateInningId, + match_id: matchId, + team_id: tossWinnerId, + index: tossDecision == TossDecision.bat ? 3 : 4, + innings_status: InningStatus.yetToStart, + )); + innings.add(InningModel( + id: _inningService.generateInningId, + match_id: matchId, + team_id: opponentTeamId, + index: tossDecision == TossDecision.bat ? 4 : 3, + innings_status: InningStatus.yetToStart, + )); + } + await _inningService.createInnings(innings: innings); } catch (e) { debugPrint("ScoreBoardViewNotifier: error while create innings -> $e"); state = state.copyWith(error: e, loading: false); @@ -543,16 +613,31 @@ class ScoreBoardViewNotifier extends StateNotifier { final updatedPlayer = _getUpdatedOutPlayerStatus(wicketType, playerOutId); state = state.copyWith(isMatchUpdated: false); + + final otherBattingInning = state.allInnings + .where((element) => + element.team_id == battingTeamId && + element.id != battingTeamInningId) + .firstOrNull; + final otherBowlingInning = state.allInnings + .where((element) => + element.team_id == bowlingTeamId && + element.id != bowlingTeamInningId) + .firstOrNull; await _ballScoreService.addBallScoreAndUpdateTeamDetails( score: ball, matchId: matchId, battingTeamId: battingTeamId, battingTeamInningId: battingTeamInningId, totalRuns: totalRuns, + otherInningOver: otherBattingInning?.overs ?? 0, + otherTotalRuns: otherBattingInning?.total_runs ?? 0, bowlingTeamId: bowlingTeamId, bowlingTeamInningId: bowlingTeamInningId, totalWicketTaken: wicketCount, totalBowlingTeamRuns: bowlingTeamRuns, + otherTotalWicketTaken: otherBowlingInning?.total_wickets ?? 0, + otherTotalBowlingTeamRuns: otherBowlingInning?.total_runs ?? 0, updatedPlayer: updatedPlayer, ); } catch (e) { @@ -578,15 +663,21 @@ class ScoreBoardViewNotifier extends StateNotifier { return null; } + final outPlayerPerformance = outPlayer.performance.toList().updateWhere( + where: (element) => element.inning_id == state.currentInning?.id, + updated: (oldElement) => oldElement.copyWith( + status: wicketType == WicketType.retiredHurt + ? PlayerStatus.injured + : PlayerStatus.played)); + final updatedPlayer = outPlayer.copyWith( - status: wicketType == WicketType.retiredHurt - ? PlayerStatus.injured - : PlayerStatus.played); + performance: outPlayerPerformance, + ); return MatchPlayerRequest( - id: updatedPlayer.player.id, - status: updatedPlayer.status ?? PlayerStatus.played, - index: updatedPlayer.index); + id: updatedPlayer.player.id, + performance: updatedPlayer.performance, + ); } void setOrSwitchStriker({String? batsManId}) { @@ -607,16 +698,7 @@ class ScoreBoardViewNotifier extends StateNotifier { final targetAchieved = _isTargetAchieved(); if (allOut || allDeliveryDelivered || targetAchieved) { - // match or inning complete - if (_isMatchTied()) { - state = state.copyWith(showMatchCompleteSheet: DateTime.now()); - } else { - if (state.otherInning?.innings_status == InningStatus.finish) { - state = state.copyWith(showMatchCompleteSheet: DateTime.now()); - } else { - state = state.copyWith(showInningCompleteSheet: DateTime.now()); - } - } + _handleInningComplete(); } else { List fairDeliveries = state.currentScoresList .where((element) => (element.over_number == state.overCount && @@ -646,6 +728,32 @@ class ScoreBoardViewNotifier extends StateNotifier { state = state.copyWith(isActionInProgress: false); } + void _handleInningComplete() { + // match or inning complete + switch (state.match?.match_type) { + case MatchType.testMatch: + switch (state.currentInning?.index) { + case 1 || 2: + state = state.copyWith(showInningCompleteSheet: DateTime.now()); + case 3: + if (_isTargetAchieved()) { + state = state.copyWith(showMatchCompleteSheet: DateTime.now()); + } else { + state = state.copyWith(showInningCompleteSheet: DateTime.now()); + } + case 4: + state = state.copyWith(showMatchCompleteSheet: DateTime.now()); + } + default: + if (state.otherInning?.innings_status == InningStatus.finish || + _isMatchTied()) { + state = state.copyWith(showMatchCompleteSheet: DateTime.now()); + } else { + state = state.copyWith(showInningCompleteSheet: DateTime.now()); + } + } + } + bool _isAllOut() { // yet_to_play == 0 && playing == 1 && (cont_with_inj ? injured == 0 : true) && wicket_count == (cont_with_inj ? total_wicket : total_wicket - injure_count) - 1 final battingSquad = state.match?.teams @@ -658,11 +766,15 @@ class ScoreBoardViewNotifier extends StateNotifier { int injuredCount = 0; battingSquad?.forEach((element) { - if (element.status == PlayerStatus.yetToPlay) { + final currentPerformance = element.performance + .where((element) => element.inning_id == state.currentInning?.id) + .firstOrNull; + + if (currentPerformance?.status == PlayerStatus.yetToPlay) { yetToPlayCount += 1; - } else if (element.status == PlayerStatus.playing) { + } else if (currentPerformance?.status == PlayerStatus.playing) { playingCount += 1; - } else if (element.status == PlayerStatus.injured) { + } else if (currentPerformance?.status == PlayerStatus.injured) { injuredCount += 1; } }); @@ -677,36 +789,102 @@ class ScoreBoardViewNotifier extends StateNotifier { } bool _isAllDeliveryDelivered() { - // fair_deliveries / 6 == number_of_over_decided - // number_of_total_ball == total_played_ball - final totalBalls = (state.match?.number_of_over ?? 0) * 6; - final playedBalls = ((state.overCount - 1) * 6) + state.ballCount; + switch (state.match?.match_type) { + case MatchType.testMatch: + // it will always be false as there's not limited over + return false; + default: + // fair_deliveries / 6 == number_of_over_decided + // number_of_total_ball == total_played_ball + final totalBalls = (state.match?.number_of_over ?? 0) * 6; + final playedBalls = ((state.overCount - 1) * 6) + state.ballCount; - return playedBalls == totalBalls; + return playedBalls == totalBalls; + } } bool _isTargetAchieved() { - // run >= target_run (other_teams_run + 1) - if (state.otherInning?.innings_status == InningStatus.yetToStart || - state.otherInning == null || - state.currentInning == null) { - return false; - } + switch (state.match?.match_type) { + case MatchType.testMatch: + if (state.currentInning?.index == 3 || + state.currentInning?.index == 4) { + final secondPlayingTeamId = state.currentInning?.index == 3 + ? state.otherInning?.team_id + : state.currentInning?.team_id; + + final secondPlayingTeam = state.match?.teams + .where( + (element) => element.team.id == secondPlayingTeamId, + ) + .firstOrNull; + + final firstPlayingTeam = state.match?.teams + .where( + (element) => element.team.id != secondPlayingTeamId, + ) + .firstOrNull; + if (firstPlayingTeam == null || secondPlayingTeam == null) { + return false; + } + + final isThirdInningAllOut = + state.currentInning?.index == 3 && _isAllOut(); + final isFourthInningRunning = state.currentInning?.index == 4; + + return (isThirdInningAllOut || isFourthInningRunning) && + secondPlayingTeam.run > firstPlayingTeam.run; + } else { + return false; + } + default: + // run >= target_run (other_teams_run + 1) + if (state.otherInning?.innings_status == InningStatus.yetToStart || + state.otherInning == null || + state.currentInning == null) { + return false; + } - final targetRun = (state.otherInning!.total_runs) + 1; - return state.currentInning!.total_runs >= targetRun; + final targetRun = (state.otherInning!.total_runs) + 1; + return state.currentInning!.total_runs >= targetRun; + } } bool _isMatchTied() { - // inning_complete and run == other_teams_run - final isInningComplete = _isAllOut() || _isAllDeliveryDelivered(); - if (state.otherInning?.innings_status == InningStatus.yetToStart || - state.otherInning == null) { - return false; - } + switch (state.match?.match_type) { + case MatchType.testMatch: + if (state.currentInning?.index == 4 && _isAllOut()) { + final secondPlayingTeamId = state.currentInning?.team_id; + + final secondPlayingTeam = state.match?.teams + .where( + (element) => element.team.id == secondPlayingTeamId, + ) + .firstOrNull; + + final firstPlayingTeam = state.match?.teams + .where( + (element) => element.team.id != secondPlayingTeamId, + ) + .firstOrNull; + if (firstPlayingTeam == null || secondPlayingTeam == null) { + return false; + } - return isInningComplete && - state.currentInning?.total_runs == state.otherInning?.total_runs; + return secondPlayingTeam.run == firstPlayingTeam.run; + } else { + return false; + } + default: + // inning_complete and run == other_teams_run + final isInningComplete = _isAllOut() || _isAllDeliveryDelivered(); + if (state.otherInning?.innings_status == InningStatus.yetToStart || + state.otherInning == null) { + return false; + } + + return isInningComplete && + state.currentInning?.total_runs == state.otherInning?.total_runs; + } } Future undoLastBall() async { @@ -751,6 +929,18 @@ class ScoreBoardViewNotifier extends StateNotifier { final updatedPlayers = _getUndoPlayerStatus(lastBall); state = state.copyWith(isMatchUpdated: false); + + final otherBattingInning = state.allInnings + .where((element) => + element.team_id == battingTeamId && + element.id != battingTeamInningId) + .firstOrNull; + final otherBowlingInning = state.allInnings + .where((element) => + element.team_id == bowlingTeamId && + element.id != bowlingTeamInningId) + .firstOrNull; + await _ballScoreService.deleteBallAndUpdateTeamDetails( ballId: lastBall.id!, matchId: matchId, @@ -758,9 +948,13 @@ class ScoreBoardViewNotifier extends StateNotifier { battingTeamInningId: battingTeamInningId, overCount: overCount, totalRuns: totalRuns, + otherInningOver: otherBattingInning?.overs ?? 0, + otherTotalRuns: otherBattingInning?.total_runs ?? 0, bowlingTeamId: bowlingTeamId, bowlingTeamInningId: bowlingTeamInningId, totalWicketTaken: wicketCount, + otherTotalWicketTaken: otherBowlingInning?.total_wickets ?? 0, + otherTotalBowlingTeamRuns: otherBowlingInning?.total_runs ?? 0, updatedPlayer: updatedPlayers); } catch (e) { debugPrint("ScoreBoardViewNotifier: error while undo last ball -> $e"); @@ -791,21 +985,32 @@ class ScoreBoardViewNotifier extends StateNotifier { element.player.id != lastBall.non_striker_id) .firstOrNull; + final getOutPlayersPerformance = outPlayer.performance.updateWhere( + where: (element) => element.inning_id == state.currentInning?.id, + updated: (oldElement) => oldElement.copyWith( + status: PlayerStatus.playing, + )); + List updateList = [ MatchPlayerRequest( - id: outPlayer.player.id, - status: PlayerStatus.playing, - index: outPlayer.index) + id: outPlayer.player.id, + performance: getOutPlayersPerformance, + ) ]; if (newBatsMan != null) { + final getNewBatsMansPerformance = newBatsMan.performance.updateWhere( + where: (element) => element.inning_id == state.currentInning?.id, + updated: (oldElement) => oldElement.copyWith( + status: oldElement.index == state.lastAssignedIndex + ? PlayerStatus.yetToPlay + : PlayerStatus.injured, + index: oldElement.index == state.lastAssignedIndex + ? null + : oldElement.index)); final newBatsmanRequest = MatchPlayerRequest( - id: newBatsMan.player.id, - status: newBatsMan.index == state.lastAssignedIndex - ? PlayerStatus.yetToPlay - : PlayerStatus.injured, - index: newBatsMan.index == state.lastAssignedIndex - ? null - : newBatsMan.index); + id: newBatsMan.player.id, + performance: getNewBatsMansPerformance, + ); updateList.add(newBatsmanRequest); } @@ -834,9 +1039,9 @@ class ScoreBoardViewNotifier extends StateNotifier { team_id: team.teamId, squad: team.players .map((e) => MatchPlayerRequest( - id: e.player.id, - status: e.status ?? PlayerStatus.yetToPlay, - index: e.index)) + id: e.player.id, + performance: e.performance, + )) .toList()); await _matchService.updateTeamsSquad( @@ -869,31 +1074,41 @@ class ScoreBoardViewNotifier extends StateNotifier { Future startNextInning() async { final currentInningId = state.currentInning?.id; final currentInningTeamId = state.currentInning?.team_id; - final otherInningId = state.otherInning?.id; - final otherInningTeamId = state.otherInning?.team_id; + final otherInning = state.otherInning; final matchId = state.match?.id; if (currentInningId == null || currentInningTeamId == null || - otherInningId == null || - otherInningTeamId == null || + otherInning == null || matchId == null) { return; } try { state = state.copyWith(actionError: null, isActionInProgress: true); final batsMan = state.batsMans! - .map((e) => e.copyWith(status: PlayerStatus.played)) + .map((e) => e.copyWith( + performance: e.performance.updateWhere( + where: (element) => + element.inning_id == state.currentInning?.id, + updated: (oldElement) => + oldElement.copyWith(status: PlayerStatus.played), + ))) .toList(); + await _updateMatchPlayerStatus( (teamId: currentInningTeamId, players: batsMan)); - await _inningService.updateInningStatus( - inningId: currentInningId, status: InningStatus.finish); - await _inningService.updateInningStatus( - inningId: otherInningId, status: InningStatus.running); + final runningInning = + state.nextInning != null ? state.nextInning! : otherInning; + + await _inningService.updateInningsStatuses({ + currentInningId: InningStatus.finish, + runningInning.id: InningStatus.running + }); await _matchService.updateCurrentPlayingTeam( - matchId: matchId, teamId: otherInningTeamId); + matchId: matchId, + teamId: runningInning.team_id, + ); state = state.copyWith( lastAssignedIndex: 0, @@ -901,12 +1116,17 @@ class ScoreBoardViewNotifier extends StateNotifier { ballCount: 0, bowler: null, batsMans: List.empty(), - previousScoresList: state.currentScoresList, + previousScoresList: + runningInning.index == 3 ? List.empty() : state.currentScoresList, currentScoresList: List.empty(), continueWithInjuredPlayers: true, showSelectPlayerSheet: DateTime.now(), + ballScoreQueryListenerSet: runningInning.index == 3 + ? false + : state.ballScoreQueryListenerSet, isActionInProgress: false); } catch (e) { + debugPrint("ScoreBoardViewNotifier: error while start next inning -> $e"); state = state.copyWith(actionError: e, isActionInProgress: false); } } @@ -940,7 +1160,13 @@ class ScoreBoardViewNotifier extends StateNotifier { List batsMan = []; if (state.batsMans?.isNotEmpty ?? false) { batsMan = state.batsMans! - .map((e) => e.copyWith(status: PlayerStatus.played)) + .map((e) => e.copyWith( + performance: e.performance.updateWhere( + where: (element) => + element.inning_id == state.currentInning?.id, + updated: (oldElement) => + oldElement.copyWith(status: PlayerStatus.played), + ))) .toList(); await _updateMatchPlayerStatus(( @@ -1012,13 +1238,34 @@ class ScoreBoardViewNotifier extends StateNotifier { for (int index = 0; index < statusUpdatedSquad.length; index++) { int batsManIndex = state.lastAssignedIndex + 1; - if (statusUpdatedSquad.elementAt(index).index == null || - statusUpdatedSquad.elementAt(index).index == 0 || - statusUpdatedSquad.elementAt(index).status == - PlayerStatus.injured) { - statusUpdatedSquad[index] = statusUpdatedSquad - .elementAt(index) - .copyWith(index: batsManIndex, status: PlayerStatus.playing); + final playerPerformance = statusUpdatedSquad + .elementAt(index) + .performance + .where((element) => element.inning_id == state.currentInning?.id) + .firstOrNull; + + if (playerPerformance?.index == null || + playerPerformance?.index == 0 || + playerPerformance?.status == PlayerStatus.injured) { + statusUpdatedSquad[index] = + statusUpdatedSquad.elementAt(index).copyWith( + performance: statusUpdatedSquad + .elementAt(index) + .performance + .updateWhere( + where: (element) => + element.inning_id == state.currentInning?.id, + updated: (oldElement) => oldElement.copyWith( + index: batsManIndex, + status: PlayerStatus.playing), + onNotFound: state.currentInning?.id == null + ? null + : () => PlayerPerformance( + inning_id: state.currentInning?.id ?? '', + status: PlayerStatus.playing, + index: batsManIndex), + ), + ); state = state.copyWith(lastAssignedIndex: batsManIndex); } } @@ -1032,6 +1279,7 @@ class ScoreBoardViewNotifier extends StateNotifier { _configureStrikerId(); } catch (e) { + debugPrint("ScoreBoardViewNotifier: error while set players -> $e"); state = state.copyWith(actionError: e, isActionInProgress: false); } } @@ -1060,22 +1308,6 @@ class ScoreBoardViewNotifier extends StateNotifier { return OverStatModel(run: run, wicket: wicket, extra: extras); } - TeamRunStat getTeamRunDetails(bool isFirstInning) { - final teamInning = isFirstInning ? state.currentInning : state.otherInning; - - final teamName = state.match?.teams - .where((element) => element.team.id == teamInning?.team_id) - .firstOrNull - ?.team - .name; - - return TeamRunStat( - teamName: teamName ?? "", - run: teamInning?.total_runs ?? 0, - wicket: teamInning?.total_wickets ?? 0, - over: teamInning?.overs ?? 0); - } - String getOverCount() { return state.currentInning?.overs.toString() ?? "${state.overCount - 1}.${state.ballCount}"; @@ -1122,16 +1354,22 @@ class ScoreBoardViewNotifier extends StateNotifier { return teamPlayers ?? []; } else { return teamPlayers - ?.where((element) => _isPlayerEligibleForBatsman(element.status)) + ?.where((element) => _isPlayerEligibleForBatsman(element + .performance + .where( + (element) => element.inning_id == state.currentInning?.id) + .firstOrNull + ?.status)) .toList() ?? []; } } bool _isPlayerEligibleForBatsman(PlayerStatus? status) { - return status != PlayerStatus.played && - status != PlayerStatus.playing && - status != PlayerStatus.suspended; + return (status != PlayerStatus.played && + status != PlayerStatus.playing && + status != PlayerStatus.suspended) || + status == null; } List getFielderList() { @@ -1173,7 +1411,7 @@ class ScoreBoardViewNotifier extends StateNotifier { } _cancelStreamSubscription() async { - await _matchStreamSubscription.cancel(); + await _matchStreamSubscription?.cancel(); await _ballScoreStreamSubscription?.cancel(); await _matchStreamController.close(); } @@ -1201,6 +1439,7 @@ class ScoreBoardViewState with _$ScoreBoardViewState { MatchPlayer? bowler, String? strikerId, List? batsMans, + InningModel? nextInning, DateTime? showSelectFieldingPositionSheet, DateTime? showSelectBatsManSheet, DateTime? showSelectBowlerSheet, @@ -1223,6 +1462,7 @@ class ScoreBoardViewState with _$ScoreBoardViewState { ScoreButton? tappedButton, bool? isLongTap, FieldingPositionType? position, + @Default([]) List allInnings, @Default([]) List currentScoresList, @Default([]) List previousScoresList, @Default(false) bool loading, diff --git a/khelo/lib/ui/flow/score_board/score_board_view_model.freezed.dart b/khelo/lib/ui/flow/score_board/score_board_view_model.freezed.dart index da5bd8c5..ee01cc3c 100644 --- a/khelo/lib/ui/flow/score_board/score_board_view_model.freezed.dart +++ b/khelo/lib/ui/flow/score_board/score_board_view_model.freezed.dart @@ -24,6 +24,7 @@ mixin _$ScoreBoardViewState { MatchPlayer? get bowler => throw _privateConstructorUsedError; String? get strikerId => throw _privateConstructorUsedError; List? get batsMans => throw _privateConstructorUsedError; + InningModel? get nextInning => throw _privateConstructorUsedError; DateTime? get showSelectFieldingPositionSheet => throw _privateConstructorUsedError; DateTime? get showSelectBatsManSheet => throw _privateConstructorUsedError; @@ -52,6 +53,7 @@ mixin _$ScoreBoardViewState { ScoreButton? get tappedButton => throw _privateConstructorUsedError; bool? get isLongTap => throw _privateConstructorUsedError; FieldingPositionType? get position => throw _privateConstructorUsedError; + List get allInnings => throw _privateConstructorUsedError; List get currentScoresList => throw _privateConstructorUsedError; List get previousScoresList => @@ -88,6 +90,7 @@ abstract class $ScoreBoardViewStateCopyWith<$Res> { MatchPlayer? bowler, String? strikerId, List? batsMans, + InningModel? nextInning, DateTime? showSelectFieldingPositionSheet, DateTime? showSelectBatsManSheet, DateTime? showSelectBowlerSheet, @@ -110,6 +113,7 @@ abstract class $ScoreBoardViewStateCopyWith<$Res> { ScoreButton? tappedButton, bool? isLongTap, FieldingPositionType? position, + List allInnings, List currentScoresList, List previousScoresList, bool loading, @@ -128,6 +132,7 @@ abstract class $ScoreBoardViewStateCopyWith<$Res> { $InningModelCopyWith<$Res>? get currentInning; $InningModelCopyWith<$Res>? get otherInning; $MatchPlayerCopyWith<$Res>? get bowler; + $InningModelCopyWith<$Res>? get nextInning; } /// @nodoc @@ -151,6 +156,7 @@ class _$ScoreBoardViewStateCopyWithImpl<$Res, $Val extends ScoreBoardViewState> Object? bowler = freezed, Object? strikerId = freezed, Object? batsMans = freezed, + Object? nextInning = freezed, Object? showSelectFieldingPositionSheet = freezed, Object? showSelectBatsManSheet = freezed, Object? showSelectBowlerSheet = freezed, @@ -173,6 +179,7 @@ class _$ScoreBoardViewStateCopyWithImpl<$Res, $Val extends ScoreBoardViewState> Object? tappedButton = freezed, Object? isLongTap = freezed, Object? position = freezed, + Object? allInnings = null, Object? currentScoresList = null, Object? previousScoresList = null, Object? loading = null, @@ -214,6 +221,10 @@ class _$ScoreBoardViewStateCopyWithImpl<$Res, $Val extends ScoreBoardViewState> ? _value.batsMans : batsMans // ignore: cast_nullable_to_non_nullable as List?, + nextInning: freezed == nextInning + ? _value.nextInning + : nextInning // ignore: cast_nullable_to_non_nullable + as InningModel?, showSelectFieldingPositionSheet: freezed == showSelectFieldingPositionSheet ? _value.showSelectFieldingPositionSheet @@ -304,6 +315,10 @@ class _$ScoreBoardViewStateCopyWithImpl<$Res, $Val extends ScoreBoardViewState> ? _value.position : position // ignore: cast_nullable_to_non_nullable as FieldingPositionType?, + allInnings: null == allInnings + ? _value.allInnings + : allInnings // ignore: cast_nullable_to_non_nullable + as List, currentScoresList: null == currentScoresList ? _value.currentScoresList : currentScoresList // ignore: cast_nullable_to_non_nullable @@ -406,6 +421,18 @@ class _$ScoreBoardViewStateCopyWithImpl<$Res, $Val extends ScoreBoardViewState> return _then(_value.copyWith(bowler: value) as $Val); }); } + + @override + @pragma('vm:prefer-inline') + $InningModelCopyWith<$Res>? get nextInning { + if (_value.nextInning == null) { + return null; + } + + return $InningModelCopyWith<$Res>(_value.nextInning!, (value) { + return _then(_value.copyWith(nextInning: value) as $Val); + }); + } } /// @nodoc @@ -425,6 +452,7 @@ abstract class _$$ScoreBoardViewStateImplCopyWith<$Res> MatchPlayer? bowler, String? strikerId, List? batsMans, + InningModel? nextInning, DateTime? showSelectFieldingPositionSheet, DateTime? showSelectBatsManSheet, DateTime? showSelectBowlerSheet, @@ -447,6 +475,7 @@ abstract class _$$ScoreBoardViewStateImplCopyWith<$Res> ScoreButton? tappedButton, bool? isLongTap, FieldingPositionType? position, + List allInnings, List currentScoresList, List previousScoresList, bool loading, @@ -469,6 +498,8 @@ abstract class _$$ScoreBoardViewStateImplCopyWith<$Res> $InningModelCopyWith<$Res>? get otherInning; @override $MatchPlayerCopyWith<$Res>? get bowler; + @override + $InningModelCopyWith<$Res>? get nextInning; } /// @nodoc @@ -490,6 +521,7 @@ class __$$ScoreBoardViewStateImplCopyWithImpl<$Res> Object? bowler = freezed, Object? strikerId = freezed, Object? batsMans = freezed, + Object? nextInning = freezed, Object? showSelectFieldingPositionSheet = freezed, Object? showSelectBatsManSheet = freezed, Object? showSelectBowlerSheet = freezed, @@ -512,6 +544,7 @@ class __$$ScoreBoardViewStateImplCopyWithImpl<$Res> Object? tappedButton = freezed, Object? isLongTap = freezed, Object? position = freezed, + Object? allInnings = null, Object? currentScoresList = null, Object? previousScoresList = null, Object? loading = null, @@ -553,6 +586,10 @@ class __$$ScoreBoardViewStateImplCopyWithImpl<$Res> ? _value._batsMans : batsMans // ignore: cast_nullable_to_non_nullable as List?, + nextInning: freezed == nextInning + ? _value.nextInning + : nextInning // ignore: cast_nullable_to_non_nullable + as InningModel?, showSelectFieldingPositionSheet: freezed == showSelectFieldingPositionSheet ? _value.showSelectFieldingPositionSheet @@ -643,6 +680,10 @@ class __$$ScoreBoardViewStateImplCopyWithImpl<$Res> ? _value.position : position // ignore: cast_nullable_to_non_nullable as FieldingPositionType?, + allInnings: null == allInnings + ? _value._allInnings + : allInnings // ignore: cast_nullable_to_non_nullable + as List, currentScoresList: null == currentScoresList ? _value._currentScoresList : currentScoresList // ignore: cast_nullable_to_non_nullable @@ -711,6 +752,7 @@ class _$ScoreBoardViewStateImpl implements _ScoreBoardViewState { this.bowler, this.strikerId, final List? batsMans, + this.nextInning, this.showSelectFieldingPositionSheet, this.showSelectBatsManSheet, this.showSelectBowlerSheet, @@ -733,6 +775,7 @@ class _$ScoreBoardViewStateImpl implements _ScoreBoardViewState { this.tappedButton, this.isLongTap, this.position, + final List allInnings = const [], final List currentScoresList = const [], final List previousScoresList = const [], this.loading = false, @@ -747,6 +790,7 @@ class _$ScoreBoardViewStateImpl implements _ScoreBoardViewState { this.overCount = 1, this.lastAssignedIndex = 0}) : _batsMans = batsMans, + _allInnings = allInnings, _currentScoresList = currentScoresList, _previousScoresList = previousScoresList; @@ -774,6 +818,8 @@ class _$ScoreBoardViewStateImpl implements _ScoreBoardViewState { return EqualUnmodifiableListView(value); } + @override + final InningModel? nextInning; @override final DateTime? showSelectFieldingPositionSheet; @override @@ -818,6 +864,15 @@ class _$ScoreBoardViewStateImpl implements _ScoreBoardViewState { final bool? isLongTap; @override final FieldingPositionType? position; + final List _allInnings; + @override + @JsonKey() + List get allInnings { + if (_allInnings is EqualUnmodifiableListView) return _allInnings; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_allInnings); + } + final List _currentScoresList; @override @JsonKey() @@ -874,7 +929,7 @@ class _$ScoreBoardViewStateImpl implements _ScoreBoardViewState { @override String toString() { - return 'ScoreBoardViewState(error: $error, actionError: $actionError, match: $match, currentInning: $currentInning, otherInning: $otherInning, bowler: $bowler, strikerId: $strikerId, batsMans: $batsMans, showSelectFieldingPositionSheet: $showSelectFieldingPositionSheet, showSelectBatsManSheet: $showSelectBatsManSheet, showSelectBowlerSheet: $showSelectBowlerSheet, showSelectBowlerAndBatsManSheet: $showSelectBowlerAndBatsManSheet, showSelectPlayerSheet: $showSelectPlayerSheet, showSelectWicketTypeSheet: $showSelectWicketTypeSheet, showStrikerSelectionSheet: $showStrikerSelectionSheet, showUndoBallConfirmationDialog: $showUndoBallConfirmationDialog, showOverCompleteSheet: $showOverCompleteSheet, showInningCompleteSheet: $showInningCompleteSheet, showMatchCompleteSheet: $showMatchCompleteSheet, showAddExtraSheetForNoBall: $showAddExtraSheetForNoBall, showAddExtraSheetForLegBye: $showAddExtraSheetForLegBye, showAddExtraSheetForBye: $showAddExtraSheetForBye, showAddExtraSheetForFiveSeven: $showAddExtraSheetForFiveSeven, showPauseScoringSheet: $showPauseScoringSheet, showAddPenaltyRunSheet: $showAddPenaltyRunSheet, showEndMatchSheet: $showEndMatchSheet, invalidUndoToast: $invalidUndoToast, tappedButton: $tappedButton, isLongTap: $isLongTap, position: $position, currentScoresList: $currentScoresList, previousScoresList: $previousScoresList, loading: $loading, pop: $pop, continueWithInjuredPlayers: $continueWithInjuredPlayers, ballScoreQueryListenerSet: $ballScoreQueryListenerSet, isMatchUpdated: $isMatchUpdated, isActionInProgress: $isActionInProgress, showForLessRun: $showForLessRun, showForDotBall: $showForDotBall, ballCount: $ballCount, overCount: $overCount, lastAssignedIndex: $lastAssignedIndex)'; + return 'ScoreBoardViewState(error: $error, actionError: $actionError, match: $match, currentInning: $currentInning, otherInning: $otherInning, bowler: $bowler, strikerId: $strikerId, batsMans: $batsMans, nextInning: $nextInning, showSelectFieldingPositionSheet: $showSelectFieldingPositionSheet, showSelectBatsManSheet: $showSelectBatsManSheet, showSelectBowlerSheet: $showSelectBowlerSheet, showSelectBowlerAndBatsManSheet: $showSelectBowlerAndBatsManSheet, showSelectPlayerSheet: $showSelectPlayerSheet, showSelectWicketTypeSheet: $showSelectWicketTypeSheet, showStrikerSelectionSheet: $showStrikerSelectionSheet, showUndoBallConfirmationDialog: $showUndoBallConfirmationDialog, showOverCompleteSheet: $showOverCompleteSheet, showInningCompleteSheet: $showInningCompleteSheet, showMatchCompleteSheet: $showMatchCompleteSheet, showAddExtraSheetForNoBall: $showAddExtraSheetForNoBall, showAddExtraSheetForLegBye: $showAddExtraSheetForLegBye, showAddExtraSheetForBye: $showAddExtraSheetForBye, showAddExtraSheetForFiveSeven: $showAddExtraSheetForFiveSeven, showPauseScoringSheet: $showPauseScoringSheet, showAddPenaltyRunSheet: $showAddPenaltyRunSheet, showEndMatchSheet: $showEndMatchSheet, invalidUndoToast: $invalidUndoToast, tappedButton: $tappedButton, isLongTap: $isLongTap, position: $position, allInnings: $allInnings, currentScoresList: $currentScoresList, previousScoresList: $previousScoresList, loading: $loading, pop: $pop, continueWithInjuredPlayers: $continueWithInjuredPlayers, ballScoreQueryListenerSet: $ballScoreQueryListenerSet, isMatchUpdated: $isMatchUpdated, isActionInProgress: $isActionInProgress, showForLessRun: $showForLessRun, showForDotBall: $showForDotBall, ballCount: $ballCount, overCount: $overCount, lastAssignedIndex: $lastAssignedIndex)'; } @override @@ -894,6 +949,8 @@ class _$ScoreBoardViewStateImpl implements _ScoreBoardViewState { (identical(other.strikerId, strikerId) || other.strikerId == strikerId) && const DeepCollectionEquality().equals(other._batsMans, _batsMans) && + (identical(other.nextInning, nextInning) || + other.nextInning == nextInning) && (identical(other.showSelectFieldingPositionSheet, showSelectFieldingPositionSheet) || other.showSelectFieldingPositionSheet == showSelectFieldingPositionSheet) && @@ -932,13 +989,13 @@ class _$ScoreBoardViewStateImpl implements _ScoreBoardViewState { showAddExtraSheetForFiveSeven) && (identical(other.showPauseScoringSheet, showPauseScoringSheet) || other.showPauseScoringSheet == showPauseScoringSheet) && - (identical(other.showAddPenaltyRunSheet, showAddPenaltyRunSheet) || - other.showAddPenaltyRunSheet == showAddPenaltyRunSheet) && + (identical(other.showAddPenaltyRunSheet, showAddPenaltyRunSheet) || other.showAddPenaltyRunSheet == showAddPenaltyRunSheet) && (identical(other.showEndMatchSheet, showEndMatchSheet) || other.showEndMatchSheet == showEndMatchSheet) && (identical(other.invalidUndoToast, invalidUndoToast) || other.invalidUndoToast == invalidUndoToast) && (identical(other.tappedButton, tappedButton) || other.tappedButton == tappedButton) && (identical(other.isLongTap, isLongTap) || other.isLongTap == isLongTap) && (identical(other.position, position) || other.position == position) && + const DeepCollectionEquality().equals(other._allInnings, _allInnings) && const DeepCollectionEquality().equals(other._currentScoresList, _currentScoresList) && const DeepCollectionEquality().equals(other._previousScoresList, _previousScoresList) && (identical(other.loading, loading) || other.loading == loading) && @@ -965,6 +1022,7 @@ class _$ScoreBoardViewStateImpl implements _ScoreBoardViewState { bowler, strikerId, const DeepCollectionEquality().hash(_batsMans), + nextInning, showSelectFieldingPositionSheet, showSelectBatsManSheet, showSelectBowlerSheet, @@ -987,6 +1045,7 @@ class _$ScoreBoardViewStateImpl implements _ScoreBoardViewState { tappedButton, isLongTap, position, + const DeepCollectionEquality().hash(_allInnings), const DeepCollectionEquality().hash(_currentScoresList), const DeepCollectionEquality().hash(_previousScoresList), loading, @@ -1020,6 +1079,7 @@ abstract class _ScoreBoardViewState implements ScoreBoardViewState { final MatchPlayer? bowler, final String? strikerId, final List? batsMans, + final InningModel? nextInning, final DateTime? showSelectFieldingPositionSheet, final DateTime? showSelectBatsManSheet, final DateTime? showSelectBowlerSheet, @@ -1042,6 +1102,7 @@ abstract class _ScoreBoardViewState implements ScoreBoardViewState { final ScoreButton? tappedButton, final bool? isLongTap, final FieldingPositionType? position, + final List allInnings, final List currentScoresList, final List previousScoresList, final bool loading, @@ -1073,6 +1134,8 @@ abstract class _ScoreBoardViewState implements ScoreBoardViewState { @override List? get batsMans; @override + InningModel? get nextInning; + @override DateTime? get showSelectFieldingPositionSheet; @override DateTime? get showSelectBatsManSheet; @@ -1117,6 +1180,8 @@ abstract class _ScoreBoardViewState implements ScoreBoardViewState { @override FieldingPositionType? get position; @override + List get allInnings; + @override List get currentScoresList; @override List get previousScoresList; diff --git a/khelo/lib/ui/flow/team/detail/team_detail_view_model.dart b/khelo/lib/ui/flow/team/detail/team_detail_view_model.dart index 9da0ba27..275e3c24 100644 --- a/khelo/lib/ui/flow/team/detail/team_detail_view_model.dart +++ b/khelo/lib/ui/flow/team/detail/team_detail_view_model.dart @@ -20,8 +20,8 @@ final teamDetailStateProvider = )); class TeamDetailViewNotifier extends StateNotifier { - late StreamSubscription _teamStreamSubscription; - late StreamSubscription _matchListStreamSubscription; + StreamSubscription? _teamStreamSubscription; + StreamSubscription? _matchListStreamSubscription; final TeamService _teamService; final MatchService _matchService; String? teamId; @@ -194,15 +194,15 @@ class TeamDetailViewNotifier extends StateNotifier { } onResume() { - _teamStreamSubscription.cancel(); - _matchListStreamSubscription.cancel(); + _teamStreamSubscription?.cancel(); + _matchListStreamSubscription?.cancel(); loadTeamById(); } @override void dispose() { - _teamStreamSubscription.cancel(); - _matchListStreamSubscription.cancel(); + _teamStreamSubscription?.cancel(); + _matchListStreamSubscription?.cancel(); super.dispose(); } } diff --git a/khelo/pubspec.lock b/khelo/pubspec.lock index 95fbd256..50294e23 100644 --- a/khelo/pubspec.lock +++ b/khelo/pubspec.lock @@ -864,18 +864,18 @@ packages: dependency: transitive description: name: leak_tracker - sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a" + sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05" url: "https://pub.dev" source: hosted - version: "10.0.4" + version: "10.0.5" leak_tracker_flutter_testing: dependency: transitive description: name: leak_tracker_flutter_testing - sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8" + sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806" url: "https://pub.dev" source: hosted - version: "3.0.3" + version: "3.0.5" leak_tracker_testing: dependency: transitive description: @@ -912,18 +912,18 @@ packages: dependency: transitive description: name: material_color_utilities - sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a" + sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec url: "https://pub.dev" source: hosted - version: "0.8.0" + version: "0.11.1" meta: dependency: transitive description: name: meta - sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136" + sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 url: "https://pub.dev" source: hosted - version: "1.12.0" + version: "1.15.0" mime: dependency: transitive description: @@ -1348,26 +1348,26 @@ packages: dependency: transitive description: name: test - sha256: "7ee446762c2c50b3bd4ea96fe13ffac69919352bd3b4b17bac3f3465edc58073" + sha256: "7ee44229615f8f642b68120165ae4c2a75fe77ae2065b1e55ae4711f6cf0899e" url: "https://pub.dev" source: hosted - version: "1.25.2" + version: "1.25.7" test_api: dependency: transitive description: name: test_api - sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f" + sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb" url: "https://pub.dev" source: hosted - version: "0.7.0" + version: "0.7.2" test_core: dependency: transitive description: name: test_core - sha256: "2bc4b4ecddd75309300d8096f781c0e3280ca1ef85beda558d33fcbedc2eead4" + sha256: "55ea5a652e38a1dfb32943a7973f3681a60f872f8c3a05a14664ad54ef9c6696" url: "https://pub.dev" source: hosted - version: "0.6.0" + version: "0.6.4" time: dependency: transitive description: @@ -1508,10 +1508,10 @@ packages: dependency: transitive description: name: vm_service - sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec" + sha256: f652077d0bdf60abe4c1f6377448e8655008eef28f128bc023f7b5e8dfeb48fc url: "https://pub.dev" source: hosted - version: "14.2.1" + version: "14.2.4" watcher: dependency: transitive description: