#281 viewer: block user swipes from the top status bar gesture insets
This commit is contained in:
parent
7a492d0a1e
commit
9c61857f9d
4 changed files with 24 additions and 0 deletions
|
@ -25,6 +25,26 @@ class BottomGestureAreaProtector extends StatelessWidget {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// It will prevent the body from scrolling when a user swipe from top to show the status bar when system UI is hidden.
|
||||||
|
class TopGestureAreaProtector extends StatelessWidget {
|
||||||
|
const TopGestureAreaProtector({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Positioned(
|
||||||
|
left: 0,
|
||||||
|
top: 0,
|
||||||
|
right: 0,
|
||||||
|
height: context.select<MediaQueryData, double>((mq) => mq.systemGestureInsets.top),
|
||||||
|
child: GestureDetector(
|
||||||
|
// absorb vertical gestures only
|
||||||
|
onVerticalDragDown: (details) {},
|
||||||
|
behavior: HitTestBehavior.translucent,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// It will prevent the body from scrolling when a user swipe from edges to use Android Q style navigation gestures.
|
// It will prevent the body from scrolling when a user swipe from edges to use Android Q style navigation gestures.
|
||||||
class SideGestureAreaProtector extends StatelessWidget {
|
class SideGestureAreaProtector extends StatelessWidget {
|
||||||
const SideGestureAreaProtector({super.key});
|
const SideGestureAreaProtector({super.key});
|
||||||
|
|
|
@ -277,6 +277,7 @@ class _EntryViewerStackState extends State<EntryViewerStack> with EntryViewContr
|
||||||
onViewDisposed: (mainEntry, pageEntry) => viewStateConductor.reset(pageEntry ?? mainEntry),
|
onViewDisposed: (mainEntry, pageEntry) => viewStateConductor.reset(pageEntry ?? mainEntry),
|
||||||
),
|
),
|
||||||
..._buildOverlays(),
|
..._buildOverlays(),
|
||||||
|
const TopGestureAreaProtector(),
|
||||||
const SideGestureAreaProtector(),
|
const SideGestureAreaProtector(),
|
||||||
const BottomGestureAreaProtector(),
|
const BottomGestureAreaProtector(),
|
||||||
],
|
],
|
||||||
|
|
|
@ -136,6 +136,8 @@ class _PanoramaPageState extends State<PanoramaPage> {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
const TopGestureAreaProtector(),
|
||||||
|
const SideGestureAreaProtector(),
|
||||||
const BottomGestureAreaProtector(),
|
const BottomGestureAreaProtector(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
|
@ -144,6 +144,7 @@ class _EntryEditorState extends State<EntryEditor> with EntryViewControllerMixin
|
||||||
bottom: 0,
|
bottom: 0,
|
||||||
child: _buildBottomOverlay(),
|
child: _buildBottomOverlay(),
|
||||||
),
|
),
|
||||||
|
const TopGestureAreaProtector(),
|
||||||
const SideGestureAreaProtector(),
|
const SideGestureAreaProtector(),
|
||||||
const BottomGestureAreaProtector(),
|
const BottomGestureAreaProtector(),
|
||||||
],
|
],
|
||||||
|
|
Loading…
Reference in a new issue