Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7dbb3d1a15 | ||
|
|
6e534ed5b7 |
@@ -123,43 +123,37 @@ struct StationDetailView: View {
|
|||||||
// clutter. The Address/Distance and Distance/actions lines
|
// clutter. The Address/Distance and Distance/actions lines
|
||||||
// stay.
|
// stay.
|
||||||
.listRowSeparator(.hidden, edges: .bottom)
|
.listRowSeparator(.hidden, edges: .bottom)
|
||||||
// The map, the address, the distance, any notices and the two
|
// The map, the address, the distance, any notices and the two
|
||||||
// station actions all share ONE card. The list's own row
|
// station actions all share ONE card (the list's own row
|
||||||
// hairlines separate them (inset, the same line that already
|
// hairlines separate them), so no hand-rolled Divider here —
|
||||||
// separates Address from Distance), so no hand-rolled Divider is
|
// adding one would double the line.
|
||||||
// needed — adding one would double the line.
|
//
|
||||||
// The station name is NOT repeated here: the sheet header
|
// The station name is NOT repeated: the sheet header already
|
||||||
// (navigationTitle, inline) already shows it, and the address
|
// shows it.
|
||||||
// line below has any leading repeat of the name stripped, so
|
|
||||||
// a "Name" row only said it twice.
|
|
||||||
//
|
//
|
||||||
// The whole row is a copy control: it puts JUST the postcode
|
// The whole row is a copy control: it puts JUST the postcode
|
||||||
// on the clipboard so it can be pasted into another
|
// on the clipboard so it can be pasted into another
|
||||||
// navigation app. The copy glyph and its "Copied"
|
// navigation app. The copy glyph sits ON the address line,
|
||||||
// confirmation share a SECOND line that is always there, so
|
// and the "Copied" confirmation is a capsule that floats OVER
|
||||||
// the confirmation can never reflow the address above it.
|
// THIS ROW — it confirms the address, so it must not hover
|
||||||
|
// over the map. It is an overlay, so nothing moves while it is
|
||||||
|
// up, and `allowsHitTesting(false)` keeps the row tappable
|
||||||
|
// through the capsule.
|
||||||
Button {
|
Button {
|
||||||
copyPostcode()
|
copyPostcode()
|
||||||
} label: {
|
} label: {
|
||||||
VStack(alignment: .leading, spacing: 6) {
|
HStack(alignment: .firstTextBaseline, spacing: 8) {
|
||||||
HStack(alignment: .firstTextBaseline, spacing: 8) {
|
Text("Address")
|
||||||
Text("Address")
|
Spacer(minLength: 8)
|
||||||
Spacer(minLength: 8)
|
Text(addressLine)
|
||||||
Text(addressLine)
|
.multilineTextAlignment(.trailing)
|
||||||
.multilineTextAlignment(.trailing)
|
.foregroundStyle(.secondary)
|
||||||
.foregroundStyle(.secondary)
|
// Stays the plain copy glyph — the capsule carries
|
||||||
}
|
// the confirmation, so swapping this to a checkmark
|
||||||
HStack(spacing: 4) {
|
// would say it twice.
|
||||||
Spacer(minLength: 0)
|
Image(systemName: "doc.on.doc")
|
||||||
if showingCopied {
|
.font(.footnote.weight(.semibold))
|
||||||
Text("Copied")
|
.foregroundStyle(.secondary)
|
||||||
.foregroundStyle(.green)
|
|
||||||
.transition(.opacity)
|
|
||||||
}
|
|
||||||
Image(systemName: showingCopied ? "checkmark" : "doc.on.doc")
|
|
||||||
.foregroundStyle(showingCopied ? Color.green : Color.secondary)
|
|
||||||
}
|
|
||||||
.font(.footnote.weight(.semibold))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.buttonStyle(.plain)
|
.buttonStyle(.plain)
|
||||||
@@ -170,6 +164,29 @@ struct StationDetailView: View {
|
|||||||
? ""
|
? ""
|
||||||
: String(localized: "Copies the postcode",
|
: String(localized: "Copies the postcode",
|
||||||
comment: "Accessibility hint for the address row in the More info sheet"))
|
comment: "Accessibility hint for the address row in the More info sheet"))
|
||||||
|
// Horizontally centred over the address line itself.
|
||||||
|
.overlay(alignment: .center) {
|
||||||
|
if showingCopied {
|
||||||
|
HStack(spacing: 4) {
|
||||||
|
Image(systemName: "checkmark")
|
||||||
|
Text("Copied")
|
||||||
|
}
|
||||||
|
.font(.footnote.weight(.semibold))
|
||||||
|
.foregroundStyle(.green)
|
||||||
|
.padding(.horizontal, 10)
|
||||||
|
.padding(.vertical, 6)
|
||||||
|
// A material base keeps it legible where the tint
|
||||||
|
// alone (the notice-capsule recipe) washes out.
|
||||||
|
.background {
|
||||||
|
Capsule()
|
||||||
|
.fill(.regularMaterial)
|
||||||
|
.overlay(Capsule().fill(Color.green.opacity(0.22)))
|
||||||
|
}
|
||||||
|
.allowsHitTesting(false)
|
||||||
|
.accessibilityHidden(true)
|
||||||
|
.transition(.opacity)
|
||||||
|
}
|
||||||
|
}
|
||||||
if let location {
|
if let location {
|
||||||
let distance = FuelStore.stationDistanceDisplay(
|
let distance = FuelStore.stationDistanceDisplay(
|
||||||
station: station, userLat: location.lat, userLng: location.lng
|
station: station, userLat: location.lat, userLng: location.lng
|
||||||
|
|||||||
Reference in New Issue
Block a user