LiveActivityBGLabelLargeView.swift 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. import Foundation
  2. import SwiftUI
  3. import WidgetKit
  4. struct LiveActivityBGLabelLargeView: View {
  5. @Environment(\.isWatchOS) var isWatchOS
  6. var context: ActivityViewContext<LiveActivityAttributes>
  7. var glucoseColor: Color
  8. var body: some View {
  9. HStack(alignment: .center) {
  10. if let trendArrow = context.state.direction {
  11. Text(context.state.bg)
  12. .fontWeight(.bold)
  13. .font(!isWatchOS ? .title : .title3)
  14. .foregroundStyle(context.isStale ? .secondary : glucoseColor)
  15. .strikethrough(context.isStale, pattern: .solid, color: .red.opacity(0.6))
  16. Text(trendArrow)
  17. .foregroundStyle(context.isStale ? .secondary : glucoseColor)
  18. .fontWeight(.bold)
  19. .font(!isWatchOS ? .headline : .subheadline)
  20. } else {
  21. Text(context.state.bg)
  22. .fontWeight(.bold)
  23. .font(!isWatchOS ? .title : .title3)
  24. .foregroundStyle(context.isStale ? .secondary : glucoseColor)
  25. .strikethrough(context.isStale, pattern: .solid, color: .red.opacity(0.6))
  26. }
  27. }
  28. }
  29. }