Compare commits

..

No commits in common. "305aba510fee632aeccadbfa5b0e4e883abbdca9" and "976427f9dface27460bbc9b426e8c4ec384caf5d" have entirely different histories.

View file

@ -204,11 +204,6 @@ class _SwipeableState extends State<Swipeable> 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
bool get wantKeepAlive => _moveController.isAnimating == true;
@ -242,22 +237,8 @@ class _SwipeableState extends State<Swipeable> with TickerProviderStateMixin, Au
}
void _handlePointerDown(PointerDownEvent event) {
final xPos = event.position.dx;
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!;
}
if(validTouch && _maxX != null){
validTouch = xPos < _maxX!;
}
setState(() {
_isTouch = validTouch;
_isTouch = widget.allowedPointerKinds.contains(event.kind);
});
}
@ -448,20 +429,6 @@ class _SwipeableState extends State<Swipeable> 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){
WidgetsBinding.instance.addPostFrameCallback((_) {
setState(() {
_minX = mediaQuery.systemGestureInsets.left;
_maxX = mediaQuery.size.width - mediaQuery.systemGestureInsets.right;
});
});
}
}
Widget content = SlideTransition(
position: _moveAnimation,
child: widget.child,