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