mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-04-25 04:45:54 +08:00
hide systembar when preview
Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
@@ -25,7 +25,9 @@ import 'package:PiliPlus/common/widgets/image_viewer/image.dart';
|
||||
import 'package:PiliPlus/common/widgets/image_viewer/loading_indicator.dart';
|
||||
import 'package:PiliPlus/common/widgets/image_viewer/viewer.dart';
|
||||
import 'package:PiliPlus/common/widgets/scroll_physics.dart';
|
||||
import 'package:PiliPlus/main.dart' show tmpPadding;
|
||||
import 'package:PiliPlus/models/common/image_preview_type.dart';
|
||||
import 'package:PiliPlus/plugin/pl_player/utils/fullscreen.dart';
|
||||
import 'package:PiliPlus/utils/extension/num_ext.dart';
|
||||
import 'package:PiliPlus/utils/extension/string_ext.dart';
|
||||
import 'package:PiliPlus/utils/image_utils.dart';
|
||||
@@ -76,6 +78,7 @@ class _GalleryViewerState extends State<GalleryViewer>
|
||||
late final int _quality;
|
||||
late final RxInt _currIndex;
|
||||
GlobalKey? _key;
|
||||
EdgeInsets? _padding;
|
||||
|
||||
late bool _hasInit = false;
|
||||
Player? _player;
|
||||
@@ -170,6 +173,25 @@ class _GalleryViewerState extends State<GalleryViewer>
|
||||
);
|
||||
}
|
||||
|
||||
final _hideSystemBar = PlatformUtils.isMobile && showSystemBar_;
|
||||
|
||||
@override
|
||||
void didChangeDependencies() {
|
||||
super.didChangeDependencies();
|
||||
if (_padding == null) {
|
||||
final padding = MediaQuery.viewPaddingOf(context);
|
||||
_padding = padding;
|
||||
if (_hideSystemBar) {
|
||||
tmpPadding = padding;
|
||||
hideSystemBar()!.whenComplete(
|
||||
() => WidgetsBinding.instance.addPostFrameCallback(
|
||||
(_) => tmpPadding = null,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Matrix4 _onTransform(double val) {
|
||||
final scale = val.lerp(1.0, 0.25);
|
||||
|
||||
@@ -259,6 +281,9 @@ class _GalleryViewerState extends State<GalleryViewer>
|
||||
}
|
||||
Future.delayed(const Duration(milliseconds: 200), _currIndex.close);
|
||||
super.dispose();
|
||||
if (_hideSystemBar) {
|
||||
showSystemBar();
|
||||
}
|
||||
}
|
||||
|
||||
void _onPointerDown(PointerDownEvent event) {
|
||||
@@ -311,9 +336,7 @@ class _GalleryViewerState extends State<GalleryViewer>
|
||||
right: 0,
|
||||
child: IgnorePointer(
|
||||
child: Container(
|
||||
padding:
|
||||
MediaQuery.viewPaddingOf(context) +
|
||||
const EdgeInsets.fromLTRB(12, 8, 20, 8),
|
||||
padding: _padding! + const EdgeInsets.fromLTRB(12, 8, 20, 8),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.topCenter,
|
||||
|
||||
Reference in New Issue
Block a user