Watch: notification switches, a model list and Ask before acting on new threads, and Ask before acting on a thread
This commit is contained in:
1 parent
3cc7e40852
commit
6bc9cac6ca
14 files changed
+623
-81
No files matched your search
@@ -45,6 +45,52 @@ struct Card<Content: View>: View {
|
||||
}
|
||||
}
|
||||
|
||||
/// A card holding one switch, like the mocks' setting rows. `tint` fills the switch when it is on.
|
||||
/// The whole card toggles it.
|
||||
struct SwitchCard: View {
|
||||
var title: String
|
||||
@Binding var isOn: Bool
|
||||
var tint: Color = Theme.work
|
||||
var edge: Color = Theme.card
|
||||
|
||||
var body: some View {
|
||||
Toggle(isOn: $isOn) {
|
||||
Text(title)
|
||||
.font(.system(size: 14, weight: .semibold))
|
||||
.foregroundStyle(.white)
|
||||
}
|
||||
.toggleStyle(CardSwitchStyle(tint: tint, edge: edge))
|
||||
}
|
||||
}
|
||||
|
||||
/// The mocks' switch drawn by hand: watchOS's own renders as a placeholder in snapshots.
|
||||
private struct CardSwitchStyle: ToggleStyle {
|
||||
var tint: Color
|
||||
var edge: Color
|
||||
|
||||
func makeBody(configuration: Configuration) -> some View {
|
||||
Button { configuration.isOn.toggle() } label: {
|
||||
Card(edge: edge) {
|
||||
HStack {
|
||||
configuration.label
|
||||
Spacer(minLength: 4)
|
||||
Capsule()
|
||||
.fill(configuration.isOn ? tint : Color(white: 0.23))
|
||||
.frame(width: 40, height: 24)
|
||||
.overlay(alignment: configuration.isOn ? .trailing : .leading) {
|
||||
Circle().fill(.white).padding(2.5)
|
||||
}
|
||||
}
|
||||
}
|
||||
.contentShape(Rectangle())
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
.accessibilityRepresentation {
|
||||
Toggle(isOn: configuration.$isOn) { configuration.label }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A full-width pill button, like mock B's Reply and Say the task.
|
||||
struct PillButtonStyle: ButtonStyle {
|
||||
var fill: Color
|
||||
|
||||
Reference in new issue
Block a user