feat: redesign Dynamic Island with phase-driven UI and animations
This commit is contained in:
@@ -41,13 +41,38 @@ struct MusicLiveActivity: Widget {
|
||||
LiveActivityMusicBars()
|
||||
}
|
||||
}
|
||||
.background(
|
||||
RadialGradient(
|
||||
stops: [
|
||||
.init(color: Color.green.opacity(context.state.isPlaying ? 0.1 : 0.03), location: 0),
|
||||
.init(color: .clear, location: 1)
|
||||
],
|
||||
center: .center,
|
||||
startRadius: 0,
|
||||
endRadius: 30
|
||||
)
|
||||
)
|
||||
.opacity(context.state.isPlaying ? 1.0 : 0.5)
|
||||
.animation(.easeInOut(duration: 0.3), value: context.state.isPlaying)
|
||||
}
|
||||
DynamicIslandExpandedRegion(.center) {
|
||||
Text(context.state.artist)
|
||||
.font(.caption2)
|
||||
.foregroundStyle(.secondary)
|
||||
.lineLimit(1)
|
||||
.accessibilityLabel(context.state.artist)
|
||||
HStack(spacing: 6) {
|
||||
RoundedRectangle(cornerRadius: 4, style: .continuous)
|
||||
.fill(LinearGradient(
|
||||
colors: [.green.opacity(0.4), .mint.opacity(0.3)],
|
||||
startPoint: .topLeading,
|
||||
endPoint: .bottomTrailing
|
||||
))
|
||||
.frame(width: 20, height: 20)
|
||||
|
||||
Text(context.state.artist)
|
||||
.font(.caption2)
|
||||
.foregroundStyle(.secondary)
|
||||
.lineLimit(1)
|
||||
.accessibilityLabel(context.state.artist)
|
||||
}
|
||||
.opacity(context.state.isPlaying ? 1.0 : 0.5)
|
||||
.animation(.easeInOut(duration: 0.3), value: context.state.isPlaying)
|
||||
}
|
||||
DynamicIslandExpandedRegion(.trailing) {
|
||||
Button(intent: SkipTrackIntent()) {
|
||||
@@ -73,10 +98,14 @@ struct MusicLiveActivity: Widget {
|
||||
.accessibilityLabel("Music playing")
|
||||
} compactTrailing: {
|
||||
HStack(spacing: 3) {
|
||||
Image(systemName: "music.note")
|
||||
.font(.system(size: 10))
|
||||
.foregroundStyle(.green)
|
||||
.accessibilityHidden(true)
|
||||
if context.state.isPlaying {
|
||||
LiveActivityMusicBars()
|
||||
} else {
|
||||
Image(systemName: "music.note")
|
||||
.font(.system(size: 10))
|
||||
.foregroundStyle(.green.opacity(0.5))
|
||||
.accessibilityHidden(true)
|
||||
}
|
||||
Text(context.state.title)
|
||||
.font(.system(size: 10, weight: .medium))
|
||||
.lineLimit(1)
|
||||
|
||||
Reference in New Issue
Block a user