blob: b9d76c672b27c5b6f06fee4748b596ea950eca75 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
import SwiftUI
struct EvolutionPickerMenu: View {
@Binding var selectedEvolution: StageType
private func select(_ stageType: StageType) {
withAnimation {
selectedEvolution = stageType
}
}
var body: some View {
VStack(alignment: .leading, spacing: 1.0) {
Section(header: EvolutionPickerMenuHeader(key: "stage_type.section.types")) {
ForEach(StageType.types) { stage in
EvolutionPickerMenuItem(stageType: stage, isSelected: selectedEvolution.id == stage.id)
.onTapGesture {
select(stage)
}
}
}
Section(header: EvolutionPickerMenuHeader(key: "stage_type.section.characteristics")) {
ForEach(StageType.characteristics) { stage in
EvolutionPickerMenuItem(stageType: stage, isSelected: selectedEvolution.id == stage.id)
.onTapGesture {
select(stage)
}
}
}
Section(header: EvolutionPickerMenuHeader(key: "stage_type.section.general_properties")) {
ForEach(StageType.properties) { stage in
EvolutionPickerMenuItem(stageType: stage, isSelected: selectedEvolution.id == stage.id)
.onTapGesture {
select(stage)
}
}
}
Section(header: EvolutionPickerMenuHeader(key: "stage_type.section.custom")) {
ForEach(StageType.customStages) { customStage in
EvolutionPickerMenuItem(
stageType: customStage,
isSelected: selectedEvolution.id == customStage.id
)
.onTapGesture {
select(customStage)
}
}
}
}
.padding(.horizontal, Dimensions.Spacing.coziest)
.padding(.vertical, Dimensions.Spacing.regular)
}
}
#Preview {
EvolutionPickerMenu(selectedEvolution: .constant(.ubiquity))
}
|