Add SegmentedPicker

This commit is contained in:
Alfonso Grillo
2023-01-12 15:45:16 +01:00
parent f8bdb378c5
commit acf59515f9
2 changed files with 87 additions and 16 deletions
@@ -27,28 +27,38 @@ struct PollHistory: View {
var body: some View {
VStack {
Picker("abc", selection: .constant(PollHistoryMode.active)) {
Text("Active Polls")
.tag(PollHistoryMode.active)
Text("Past Polls")
.tag(PollHistoryMode.past)
HStack {
SegmentedPicker(
segments: [
("Active Polls", PollHistoryMode.active),
("Past Pools", PollHistoryMode.past)
],
selection: $viewModel.mode,
interSegmentSpacing: 14
)
Spacer()
}
.pickerStyle(SegmentedPickerStyle())
ScrollView {
ForEach(0..<10) { index in
Text("Active poll number: \(index)")
}
Button {
#warning("handle action")
} label: {
Text("Load more polls")
LazyVStack(spacing: 32) {
ForEach(0..<10) { index in
Text("Active poll number: \(index)")
}
.frame(maxWidth: .infinity, alignment: .leading)
Button {
#warning("handle action")
} label: {
Text("Load more polls")
}
.frame(maxWidth: .infinity, alignment: .leading)
}
.padding(.top, 32)
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
}
.padding(.horizontal, 16)
.padding(.vertical, 32)
.frame(maxWidth: .infinity, maxHeight: .infinity)
.background(theme.colors.background.ignoresSafeArea())
.accentColor(theme.colors.accent)
}