]>
Commit | Line | Data |
---|---|---|
1 | import SwiftUI | |
2 | ||
3 | struct EvolutionPicker: View { | |
4 | ||
5 | @EnvironmentObject private var store: AppStore | |
6 | ||
7 | private var selectedEvolution: Binding<StageType> { | |
8 | Binding( | |
9 | get: { store.state.selectedEvolution }, | |
10 | set: { evolution in | |
11 | store.send(.selectEvolution(evolution: evolution)) | |
12 | } | |
13 | ) | |
14 | } | |
15 | ||
16 | var body: some View { | |
17 | Picker("Evolution", selection: selectedEvolution) { | |
18 | ForEach(StageType.types) { stage in | |
19 | Text(Stage.title(stage)).font(.theme.body).tag(stage).padding(4.0) | |
20 | } | |
21 | Divider() | |
22 | ForEach(StageType.characteristics) { stage in | |
23 | Text(Stage.title(stage)).font(.theme.body).tag(stage).padding(4.0).font(.theme.body) | |
24 | } | |
25 | Divider() | |
26 | ForEach(StageType.properties) { stage in | |
27 | Text(Stage.title(stage)).font(.theme.body).tag(stage).padding(4.0) | |
28 | } | |
29 | Divider() | |
30 | ForEach(StageType.custom) { stage in | |
31 | Text(Stage.title(stage)).font(.theme.body).tag(stage).padding(4.0) | |
32 | } | |
33 | }.font(.theme.body).padding(.horizontal, 8.0).padding(.vertical, 4.0) | |
34 | } | |
35 | } | |
36 | ||
37 | struct EvolutionPicker_Previews: PreviewProvider { | |
38 | static var previews: some View { | |
39 | EvolutionPicker() | |
40 | } | |
41 | } |