move ui showing/hiding logic to `useEffect`

This commit is contained in:
krawieck 2020-09-13 16:48:40 +02:00
parent 1e0fcf9c67
commit 2e23148532
1 changed files with 12 additions and 11 deletions

View File

@ -17,11 +17,7 @@ class MediaViewPage extends HookWidget {
final showButtons = useState(true);
final isZoomedOut = useState(true);
useEffect(() => () => SystemChrome.setEnabledSystemUIOverlays([
SystemUiOverlay.bottom,
SystemUiOverlay.top,
]));
useEffect(() {
if (showButtons.value) {
SystemChrome.setEnabledSystemUIOverlays([
SystemUiOverlay.bottom,
@ -30,6 +26,11 @@ class MediaViewPage extends HookWidget {
} else {
SystemChrome.setEnabledSystemUIOverlays([]);
}
return () => SystemChrome.setEnabledSystemUIOverlays([
SystemUiOverlay.bottom,
SystemUiOverlay.top,
]);
});
share() {
showModalBottomSheet(