Unverified Commit 514fb2c7 authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

Revert "fix edge swiping and dropping back at starting point (#31623)" (#31876)

parent 4bc35fc8
...@@ -621,7 +621,6 @@ class _CupertinoBackGestureController<T> { ...@@ -621,7 +621,6 @@ class _CupertinoBackGestureController<T> {
animateForward = velocity > 0 ? false : true; animateForward = velocity > 0 ? false : true;
else else
animateForward = controller.value > 0.5 ? true : false; animateForward = controller.value > 0.5 ? true : false;
if (animateForward) { if (animateForward) {
// The closer the panel is to dismissing, the shorter the animation is. // The closer the panel is to dismissing, the shorter the animation is.
// We want to cap the animation time, but we want to use a linear curve // We want to cap the animation time, but we want to use a linear curve
...@@ -653,8 +652,6 @@ class _CupertinoBackGestureController<T> { ...@@ -653,8 +652,6 @@ class _CupertinoBackGestureController<T> {
controller.removeStatusListener(animationStatusCallback); controller.removeStatusListener(animationStatusCallback);
}; };
controller.addStatusListener(animationStatusCallback); controller.addStatusListener(animationStatusCallback);
} else {
navigator.didStopUserGesture();
} }
} }
} }
......
...@@ -351,10 +351,6 @@ void main() { ...@@ -351,10 +351,6 @@ void main() {
await tester.pumpAndSettle(); await tester.pumpAndSettle();
expect(find.text('route'), findsOneWidget); expect(find.text('route'), findsOneWidget);
expect(find.text('push'), findsNothing); expect(find.text('push'), findsNothing);
expect(
tester.state<NavigatorState>(find.byType(Navigator)).userGestureInProgress,
false,
);
}); });
testWidgets('Fullscreen route animates correct transform values over time', (WidgetTester tester) async { testWidgets('Fullscreen route animates correct transform values over time', (WidgetTester tester) async {
...@@ -540,10 +536,6 @@ void main() { ...@@ -540,10 +536,6 @@ void main() {
await tester.pump(); await tester.pump();
expect(tester.getTopLeft(find.text('1')).dx, moreOrLessEquals(-233, epsilon: 1)); expect(tester.getTopLeft(find.text('1')).dx, moreOrLessEquals(-233, epsilon: 1));
expect(tester.getTopLeft(find.text('2')).dx, moreOrLessEquals(100)); expect(tester.getTopLeft(find.text('2')).dx, moreOrLessEquals(100));
expect(
tester.state<NavigatorState>(find.byType(Navigator)).userGestureInProgress,
true,
);
await swipeGesture.moveBy(const Offset(100, 0)); await swipeGesture.moveBy(const Offset(100, 0));
await tester.pump(); await tester.pump();
...@@ -584,10 +576,6 @@ void main() { ...@@ -584,10 +576,6 @@ void main() {
await tester.pump(); await tester.pump();
expect(tester.getTopLeft(find.text('1')).dx, moreOrLessEquals(-100)); expect(tester.getTopLeft(find.text('1')).dx, moreOrLessEquals(-100));
expect(tester.getTopLeft(find.text('2')).dx, moreOrLessEquals(500)); expect(tester.getTopLeft(find.text('2')).dx, moreOrLessEquals(500));
expect(
tester.state<NavigatorState>(find.byType(Navigator)).userGestureInProgress,
true,
);
await tester.pump(const Duration(milliseconds: 50)); await tester.pump(const Duration(milliseconds: 50));
expect(tester.getTopLeft(find.text('1')).dx, moreOrLessEquals(-19, epsilon: 1)); expect(tester.getTopLeft(find.text('1')).dx, moreOrLessEquals(-19, epsilon: 1));
...@@ -597,12 +585,6 @@ void main() { ...@@ -597,12 +585,6 @@ void main() {
// Rate of change is slowing down. // Rate of change is slowing down.
expect(tester.getTopLeft(find.text('1')).dx, moreOrLessEquals(-4, epsilon: 1)); expect(tester.getTopLeft(find.text('1')).dx, moreOrLessEquals(-4, epsilon: 1));
expect(tester.getTopLeft(find.text('2')).dx, moreOrLessEquals(787, epsilon: 1)); expect(tester.getTopLeft(find.text('2')).dx, moreOrLessEquals(787, epsilon: 1));
await tester.pumpAndSettle();
expect(
tester.state<NavigatorState>(find.byType(Navigator)).userGestureInProgress,
false,
);
}); });
testWidgets('Snapped drags forwards and backwards should signal didStart/StopUserGesture', (WidgetTester tester) async { testWidgets('Snapped drags forwards and backwards should signal didStart/StopUserGesture', (WidgetTester tester) async {
...@@ -685,63 +667,12 @@ void main() { ...@@ -685,63 +667,12 @@ void main() {
final TestGesture gesture = await tester.startGesture(const Offset(5, 200)); final TestGesture gesture = await tester.startGesture(const Offset(5, 200));
// The width of the page. // The width of the page.
await gesture.moveBy(const Offset(800, 0)); await gesture.moveBy(const Offset(800, 0));
verify(navigatorObserver.didStartUserGesture(any, any)).called(1);
await gesture.up(); await gesture.up();
await tester.pump(); await tester.pump();
expect(find.text('Page 1'), isOnstage); expect(find.text('Page 1'), isOnstage);
expect(find.text('Page 2'), findsNothing); expect(find.text('Page 2'), findsNothing);
verify(navigatorObserver.didPop(any, any)).called(1); verify(navigatorObserver.didPop(any, any)).called(1);
verify(navigatorObserver.didStopUserGesture()).called(1);
});
testWidgets('test edge swipe then drop back at starting point works', (WidgetTester tester) async {
await tester.pumpWidget(
CupertinoApp(
navigatorObservers: <NavigatorObserver>[navigatorObserver],
onGenerateRoute: (RouteSettings settings) {
return CupertinoPageRoute<void>(
settings: settings,
builder: (BuildContext context) {
final String pageNumber = settings.name == '/' ? '1' : '2';
return Center(child: Text('Page $pageNumber'));
},
);
},
),
);
tester.state<NavigatorState>(find.byType(Navigator)).pushNamed('/next');
await tester.pump();
await tester.pump(const Duration(seconds: 1));
expect(find.text('Page 1'), findsNothing);
expect(find.text('Page 2'), isOnstage);
final TestGesture gesture = await tester.startGesture(const Offset(5, 200));
// Move right a bit
await gesture.moveBy(const Offset(300, 0));
verify(navigatorObserver.didStartUserGesture(any, any)).called(1);
expect(
tester.state<NavigatorState>(find.byType(Navigator)).userGestureInProgress,
true,
);
await tester.pump();
// Move back to where we started.
await gesture.moveBy(const Offset(-300, 0));
await gesture.up();
await tester.pump();
expect(find.text('Page 1'), findsNothing);
expect(find.text('Page 2'), isOnstage);
verifyNever(navigatorObserver.didPop(any, any));
verify(navigatorObserver.didStopUserGesture()).called(1);
expect(
tester.state<NavigatorState>(find.byType(Navigator)).userGestureInProgress,
false,
);
}); });
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment