LiveActivityGlucoseDeltaLabelView.swift 660 B

12345678910111213141516171819202122232425
  1. //
  2. // LiveActivityGlucoseDeltaLabelView.swift
  3. // Trio
  4. //
  5. // Created by Cengiz Deniz on 17.10.24.
  6. //
  7. import Foundation
  8. import SwiftUI
  9. import WidgetKit
  10. struct LiveActivityGlucoseDeltaLabelView: View {
  11. var context: ActivityViewContext<LiveActivityAttributes>
  12. var glucoseColor: Color
  13. var body: some View {
  14. if !context.state.change.isEmpty {
  15. Text(context.state.change)
  16. .foregroundStyle(context.state.glucoseColorScheme == "staticColor" ? .primary : glucoseColor)
  17. .strikethrough(context.isStale, pattern: .solid, color: .red.opacity(0.6))
  18. } else {
  19. Text("--")
  20. }
  21. }
  22. }