LiveActivityBGLabelLargeView.swift 1.1 KB

123456789101112131415161718192021222324252627282930
  1. import Foundation
  2. import SwiftUI
  3. import WidgetKit
  4. struct LiveActivityBGLabelLargeView: View {
  5. var context: ActivityViewContext<LiveActivityAttributes>
  6. var additionalState: LiveActivityAttributes.ContentAdditionalState
  7. var glucoseColor: Color
  8. var body: some View {
  9. HStack {
  10. if let trendArrow = context.state.direction {
  11. Text(context.state.bg)
  12. .fontWeight(.heavy)
  13. .font(.title)
  14. .foregroundStyle(context.isStale ? .secondary : glucoseColor)
  15. .strikethrough(context.isStale, pattern: .solid, color: .red.opacity(0.6))
  16. +
  17. Text(trendArrow).foregroundStyle(context.isStale ? .secondary : glucoseColor)
  18. } else {
  19. Text(context.state.bg)
  20. .fontWeight(.heavy)
  21. .font(.title)
  22. .foregroundStyle(context.isStale ? .secondary : glucoseColor)
  23. .strikethrough(context.isStale, pattern: .solid, color: .red.opacity(0.6))
  24. }
  25. }
  26. }
  27. }