From 73cf87b2b59c179c0be2625bd5fcd4be6495227c Mon Sep 17 00:00:00 2001 From: EpicKiwi Date: Thu, 2 Jan 2025 10:16:25 +0100 Subject: [PATCH] Added some comments Signed-off-by: EpicKiwi --- lib/src/swipeable.dart | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/src/swipeable.dart b/lib/src/swipeable.dart index e29ea06..1738f72 100644 --- a/lib/src/swipeable.dart +++ b/lib/src/swipeable.dart @@ -204,7 +204,9 @@ class _SwipeableState extends State with TickerProviderStateMixin, Au bool _isTouch = true; + // Minimum global X where swipe is allowed to start double? _minX; + // Maximum global X where swipe is allowed to start double? _maxX; @override @@ -244,6 +246,8 @@ class _SwipeableState extends State with TickerProviderStateMixin, Au var validTouch = widget.allowedPointerKinds.contains(event.kind); + // Check if touch was performed after minX and before maxX to avoid system + // gesture insets if(validTouch && _minX != null){ validTouch = xPos > _minX!; } @@ -444,6 +448,8 @@ class _SwipeableState extends State with TickerProviderStateMixin, Au } } + // Get system screen size and system gesture insets + // to avoid starting a swipe in this areas MediaQueryData? mediaQuery = MediaQuery.maybeOf(context); if (mediaQuery != null) { if(_minX == null || _maxX == null){