Fix toggling full screen details

This commit is contained in:
Arkadiusz Fal
2022-06-25 18:33:35 +02:00
parent 17787fa69c
commit 69209ff771
6 changed files with 51 additions and 32 deletions

View File

@@ -42,7 +42,7 @@ struct BrowserPlayerControls<Content: View, Toolbar: View>: View {
toolbar
.borderTop(height: 0.4, color: Color("ControlsBorderColor"))
.modifier(ControlBackgroundModifier())
ControlsBar()
ControlsBar(fullScreen: .constant(false))
.edgesIgnoringSafeArea(.bottom)
}
#endif

View File

@@ -19,6 +19,9 @@ struct ControlsBar: View {
var borderTop = true
var borderBottom = true
var detailsTogglePlayer = true
var detailsToggleFullScreen = false
@Binding var fullScreen: Bool
var body: some View {
HStack(spacing: 0) {
@@ -55,6 +58,16 @@ struct ControlsBar: View {
details
.contentShape(Rectangle())
}
} else if detailsToggleFullScreen {
Button {
withAnimation {
fullScreen.toggle()
}
} label: {
details
.contentShape(Rectangle())
}
.keyboardShortcut("t")
} else {
details
}
@@ -250,7 +263,7 @@ struct ControlsBar: View {
struct ControlsBar_Previews: PreviewProvider {
static var previews: some View {
ControlsBar()
ControlsBar(fullScreen: .constant(false))
.injectFixtureEnvironmentObjects()
}
}