Show the selected routine as a symbol-and-color preview in the form
The Routine row now renders the selection like the picker list's rows (tinted symbol + name); with nothing selected it reads "Please select" in secondary style.
This commit is contained in:
@@ -180,10 +180,19 @@ struct ScheduleAddEditView: View {
|
|||||||
RoutinePickerList(routines: routines, currentID: selectedRoutine?.id,
|
RoutinePickerList(routines: routines, currentID: selectedRoutine?.id,
|
||||||
selectedID: $routineID)
|
selectedID: $routineID)
|
||||||
} label: {
|
} label: {
|
||||||
HStack {
|
// The row is the selection's preview — the routine's own symbol and
|
||||||
Text("Routine")
|
// color, matching the picker list's rows.
|
||||||
Spacer()
|
if let routine = selectedRoutine {
|
||||||
Text(selectedRoutine?.name ?? "Choose…")
|
HStack(spacing: 12) {
|
||||||
|
Image(systemName: routine.systemImage)
|
||||||
|
.font(.title3)
|
||||||
|
.foregroundStyle(Color.color(from: routine.color))
|
||||||
|
.frame(width: 32)
|
||||||
|
Text(routine.name)
|
||||||
|
.foregroundStyle(.primary)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Text("Please select")
|
||||||
.foregroundStyle(.secondary)
|
.foregroundStyle(.secondary)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user