LiveActivityBGLabelLargeView.swift 955 B

1234567891011121314151617181920212223242526272829
  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. Text(context.state.bg)
  11. .fontWeight(.bold)
  12. .font(!isWatchOS ? .title : .title3)
  13. .foregroundStyle(context.isStale ? .secondary : glucoseColor)
  14. .strikethrough(context.isStale, pattern: .solid, color: .red.opacity(0.6))
  15. if let trendArrow = context.state.direction {
  16. Text(trendArrow)
  17. .foregroundStyle(context.isStale ? .secondary : glucoseColor)
  18. .fontWeight(.bold)
  19. .font(!isWatchOS ? .headline : .subheadline)
  20. .padding(.leading, !isWatchOS ? 0 : -5)
  21. }
  22. }
  23. }
  24. }