mirror of
https://github.com/FBukovina/Atoll.git
synced 2026-10-27 23:24:32 +00:00
Update Battery Icon
This commit is contained in:
parent
cb2369e621
commit
a74d56b4e1
1 changed files with 17 additions and 1 deletions
|
|
@ -163,7 +163,7 @@ struct LockScreenWeatherWidget: View {
|
|||
Gauge(value: Double(level), in: 0...100) {
|
||||
EmptyView()
|
||||
} currentValueLabel: {
|
||||
Image(systemName: "battery.100")
|
||||
Image(systemName: batteryIconName(for: level))
|
||||
.font(.system(size: 20, weight: .semibold))
|
||||
.foregroundStyle(Color.white)
|
||||
} minimumValueLabel: {
|
||||
|
|
@ -570,6 +570,22 @@ struct LockScreenWeatherWidget: View {
|
|||
clampedBatteryLevel(battery.batteryLevel)
|
||||
)
|
||||
}
|
||||
|
||||
private func batteryIconName(for level: Int) -> String {
|
||||
let clamped = clampedBatteryLevel(level)
|
||||
switch clamped {
|
||||
case ..<10:
|
||||
return "battery.0percent"
|
||||
case 10..<40:
|
||||
return "battery.25percent"
|
||||
case 40..<70:
|
||||
return "battery.50percent"
|
||||
case 70..<90:
|
||||
return "battery.75percent"
|
||||
default:
|
||||
return "battery.100percent"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue