Enter fullscreen when hiding buttons

This commit is contained in:
krawieck 2020-09-11 10:54:03 +02:00
parent 5fa9e22cd5
commit 13b1a7ad8b
1 changed files with 15 additions and 0 deletions

View File

@ -1,5 +1,6 @@
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:photo_view/photo_view.dart';
@ -12,6 +13,20 @@ class MediaView extends HookWidget {
Widget build(BuildContext context) {
var showButtons = useState(true);
useEffect(() => () => SystemChrome.setEnabledSystemUIOverlays([
SystemUiOverlay.bottom,
SystemUiOverlay.top,
]));
if (showButtons.value) {
SystemChrome.setEnabledSystemUIOverlays([
SystemUiOverlay.bottom,
SystemUiOverlay.top,
]);
} else {
SystemChrome.setEnabledSystemUIOverlays([]);
}
return Scaffold(
appBar: AppBar(
backgroundColor: