Skip to content

Commit f23f9ff

Browse files
committed
Add a basic support for both sexes in team screen (also refactor country model - add team model)
1 parent 8bcdece commit f23f9ff

File tree

17 files changed

+281
-176
lines changed

17 files changed

+281
-176
lines changed

jumpers_female.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
[{"age":35,"name":"Philipp","surname":"Aschenwald","country":"at","sex":1,"skills":{"qualityOnSmallerHills":82.0,"qualityOnLargerHills":72.0,"landingStyle":-1,"jumpsConsistency":-1}},{"age":32,"name":"Daniel","surname":"Huber","country":"at","sex":1,"skills":{"qualityOnSmallerHills":81.24,"qualityOnLargerHills":88.0,"landingStyle":1,"jumpsConsistency":1}},{"age":37,"name":"Kamil","surname":"Stoch","country":"pl","sex":1,"skills":{"qualityOnSmallerHills":82.0,"qualityOnLargerHills":83.0,"landingStyle":3,"jumpsConsistency":2}},{"age":31,"name":"Stefan","surname":"Kraft","country":"at","sex":1,"skills":{"qualityOnSmallerHills":88.0,"qualityOnLargerHills":95.0,"landingStyle":3,"jumpsConsistency":1}},{"age":37,"name":"Dawid","surname":"Kubacki","country":"pl","sex":1,"skills":{"qualityOnSmallerHills":91.25,"qualityOnLargerHills":81.0,"landingStyle":1,"jumpsConsistency":0}}]
1+
[{"age":35,"name":"Philipp","surname":"Aschenwald","country":"at","sex":1,"skills":{"qualityOnSmallerHills":82.0,"qualityOnLargerHills":72.0,"landingStyle":-1,"jumpsConsistency":-1}},{"age":32,"name":"Daniel","surname":"Huber","country":"at","sex":1,"skills":{"qualityOnSmallerHills":81.24,"qualityOnLargerHills":88.0,"landingStyle":1,"jumpsConsistency":1}},{"age":37,"name":"Kamil","surname":"Stoch","country":"pl","sex":1,"skills":{"qualityOnSmallerHills":82.0,"qualityOnLargerHills":83.0,"landingStyle":3,"jumpsConsistency":2}},{"age":25,"name":"Silje","surname":"Opseth","country":"no","sex":1,"skills":{"qualityOnSmallerHills":87.0,"qualityOnLargerHills":94.0,"landingStyle":0,"jumpsConsistency":0}},{"age":31,"name":"Stefan","surname":"Kraft","country":"at","sex":1,"skills":{"qualityOnSmallerHills":88.0,"qualityOnLargerHills":95.0,"landingStyle":3,"jumpsConsistency":1}},{"age":37,"name":"Dawid","surname":"Kubacki","country":"pl","sex":1,"skills":{"qualityOnSmallerHills":91.25,"qualityOnLargerHills":81.0,"landingStyle":1,"jumpsConsistency":0}}]

lib/bloc/database_editing/copied_local_db_cubit.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,4 +136,8 @@ class CopiedLocalDbCubit extends Cubit<LocalDbRepo?> {
136136
fromJson: parameters.fromJson,
137137
);
138138
}
139+
140+
void dispose() {
141+
originalDb.dispose();
142+
}
139143
}

lib/models/db/local_db_repo.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ class LocalDbRepo with EquatableMixin {
138138
];
139139

140140
void dispose() {
141+
print('DISPOZE');
141142
maleJumpers.dispose();
142143
femaleJumpers.dispose();
143144
hills.dispose();
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import 'package:rxdart/rxdart.dart';
2-
import 'package:sj_manager/models/db/country/country.dart';
32
import 'package:sj_manager/models/simulations/enums.dart';
3+
import 'package:sj_manager/models/simulations/team.dart';
44

55
class SimulationWizardOptionsRepo {
66
SimulationWizardOptionsRepo();
@@ -12,10 +12,10 @@ class SimulationWizardOptionsRepo {
1212
_modeSubject.add(value);
1313
}
1414

15-
final _countrySubject = BehaviorSubject<Country?>.seeded(null);
16-
ValueStream<Country?> get countryStream => _countrySubject.stream;
17-
Country? get country => countryStream.value;
18-
set country(Country? value) {
19-
_countrySubject.add(value);
15+
final _teamSubject = BehaviorSubject<CountryTeam?>.seeded(null);
16+
ValueStream<CountryTeam?> get teamStream => _teamSubject.stream;
17+
CountryTeam? get team => teamStream.value;
18+
set team(CountryTeam? value) {
19+
_teamSubject.add(value);
2020
}
2121
}

lib/models/simulations/team.dart

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import 'package:equatable/equatable.dart';
2+
import 'package:sj_manager/models/db/country/country.dart';
3+
import 'package:sj_manager/models/db/sex.dart';
4+
5+
abstract class Team {
6+
const Team();
7+
}
8+
9+
class CountryTeam extends Team with EquatableMixin {
10+
const CountryTeam({
11+
required this.sex,
12+
required this.country,
13+
});
14+
15+
final Sex sex;
16+
final Country country;
17+
18+
CountryTeam copyWith({
19+
Sex? sex,
20+
Country? country,
21+
}) {
22+
return CountryTeam(
23+
sex: sex ?? this.sex,
24+
country: country ?? this.country,
25+
);
26+
}
27+
28+
@override
29+
List<Object?> get props => [sex, country];
30+
}

lib/repositories/generic/db_items_repo.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import 'package:rxdart/rxdart.dart';
22
import 'package:sj_manager/repositories/generic/value_repo.dart';
33

4-
abstract class DbItemsRepo<T> extends ValueRepo<List<T>> {
4+
class DbItemsRepo<T> extends ValueRepo<List<T>> {
55
DbItemsRepo({super.initial});
66

77
@override

lib/repositories/generic/editable_db_items_repo.dart

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,6 @@ class EditableDbItemsRepo<T> extends DbItemsRepo<T> {
5757
_subject.add(_items);
5858
}
5959

60-
void dispose() {
61-
_subject.close();
62-
}
63-
6460
@override
6561
List<T> get lastItems => items.value;
6662
@override

lib/repositories/generic/value_repo.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ class ValueRepo<T> {
1414
}
1515

1616
void dispose() {
17+
print('VALUEREPO DISPOSE');
1718
_subject.close();
1819
}
1920

lib/ui/screens/database_editor/large/__large.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ class _LargeState extends State<_Large> with SingleTickerProviderStateMixin {
7575
void dispose() {
7676
_bodyAnimationController.dispose();
7777
_copiedDbCubit.close();
78+
_copiedDbCubit.dispose();
7879
_dbChangeStatusCubit.close();
7980
_itemsTypeCubit.close();
8081
_selectedIndexesRepo.close();

lib/ui/screens/main_screen/large/simulation_wizard/screens/__country_screen.dart

Lines changed: 0 additions & 151 deletions
This file was deleted.

0 commit comments

Comments
 (0)