Fix video overlay buttons firing when not visible

This commit is contained in:
tommyxchow 2021-11-13 03:27:28 -05:00
parent 3275fd9123
commit 2728080400
2 changed files with 19 additions and 13 deletions

View file

@ -23,13 +23,15 @@ abstract class _VideoStoreBase with Store {
var paused = false;
void handlePausePlay() {
if (paused) {
controller.runJavascript('document.getElementsByTagName("video")[0].play();');
} else {
controller.runJavascript('document.getElementsByTagName("video")[0].pause();');
}
if (menuVisible) {
if (paused) {
controller.runJavascript('document.getElementsByTagName("video")[0].play();');
} else {
controller.runJavascript('document.getElementsByTagName("video")[0].pause();');
}
paused = !paused;
paused = !paused;
}
}
void handleVideoTap() async {

View file

@ -54,7 +54,9 @@ class Video extends StatelessWidget {
Icons.arrow_back,
color: Colors.white,
),
onPressed: () => Navigator.of(context).pop(),
onPressed: () {
if (videoStore.menuVisible) Navigator.of(context).pop();
},
),
const Spacer(),
IconButton(
@ -63,12 +65,14 @@ class Video extends StatelessWidget {
color: Colors.white,
),
onPressed: () {
showModalBottomSheet(
context: context,
builder: (context) {
return Settings(settingsStore: settingsStore);
},
);
if (videoStore.menuVisible) {
showModalBottomSheet(
context: context,
builder: (context) {
return Settings(settingsStore: settingsStore);
},
);
}
},
),
],