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