From 84cbefe2d4797476cd5ef54921e84127ad067471 Mon Sep 17 00:00:00 2001 From: Ian Hickson Date: Fri, 5 Aug 2016 13:42:55 -0700 Subject: [PATCH] Revert "When a list is scrolling, children can't be tapped" (#5264) --- examples/flutter_gallery/test/smoke_test.dart | 19 ++++++------- .../flutter/lib/src/widgets/scrollable.dart | 5 +--- .../test/widget/scrollable_fling_test.dart | 28 ------------------- 3 files changed, 9 insertions(+), 43 deletions(-) delete mode 100644 packages/flutter/test/widget/scrollable_fling_test.dart diff --git a/examples/flutter_gallery/test/smoke_test.dart b/examples/flutter_gallery/test/smoke_test.dart index 68db1db61c3..95f380968d5 100644 --- a/examples/flutter_gallery/test/smoke_test.dart +++ b/examples/flutter_gallery/test/smoke_test.dart @@ -43,9 +43,8 @@ Future smokeDemo(WidgetTester tester, String routeName) async { await tester.tap(menuItem); await tester.pump(); // Launch the demo. - await tester.pump(const Duration(seconds: 1)); // Wait until the demo has opened. - - expect(find.text('Flutter Gallery'), findsNothing); + await tester + .pump(const Duration(seconds: 1)); // Wait until the demo has opened. // Go back if (routeName == '/pesto') { @@ -65,9 +64,9 @@ Future smokeDemo(WidgetTester tester, String routeName) async { } void main() { - // TestWidgetsFlutterBinding binding = TestWidgetsFlutterBinding.ensureInitialized(); - // if (binding is LiveTestWidgetsFlutterBinding) - // binding.allowAllFrames = true; + TestWidgetsFlutterBinding binding = + TestWidgetsFlutterBinding.ensureInitialized(); + if (binding is LiveTestWidgetsFlutterBinding) binding.allowAllFrames = true; testWidgets('Flutter Gallery app smoke test', (WidgetTester tester) async { flutter_gallery_main @@ -88,17 +87,15 @@ void main() { final String routeName = routeNames[i]; await smokeDemo(tester, routeName); await tester.scroll(findGalleryItemByRouteName(tester, routeName), new Offset(0.0, scrollDeltas[i])); - await tester.pump(); // start the scroll - await tester.pump(const Duration(milliseconds: 500)); // wait for overscroll to timeout, if necessary - await tester.pump(const Duration(milliseconds: 2000)); // wait for overscroll to fade away, if necessary - tester.binding.debugAssertNoTransientCallbacks('A transient callback was still active after leaving route $routeName'); + await tester.pump(); } Finder navigationMenuButton = findNavigationMenuButton(tester); expect(navigationMenuButton, findsOneWidget); await tester.tap(navigationMenuButton); await tester.pump(); // Start opening drawer. - await tester.pump(const Duration(seconds: 1)); // Wait until it's really opened. + await tester + .pump(const Duration(seconds: 1)); // Wait until it's really opened. // switch theme await tester.tap(find.text('Dark')); diff --git a/packages/flutter/lib/src/widgets/scrollable.dart b/packages/flutter/lib/src/widgets/scrollable.dart index de61db4dae7..b502a49d4e4 100644 --- a/packages/flutter/lib/src/widgets/scrollable.dart +++ b/packages/flutter/lib/src/widgets/scrollable.dart @@ -652,10 +652,7 @@ class ScrollableState extends State { key: _gestureDetectorKey, gestures: buildGestureDetectors(), behavior: HitTestBehavior.opaque, - child: new IgnorePointer( - ignoring: _controller.isAnimating, - child: buildContent(context) - ) + child: buildContent(context) ); } diff --git a/packages/flutter/test/widget/scrollable_fling_test.dart b/packages/flutter/test/widget/scrollable_fling_test.dart deleted file mode 100644 index 3a6829f3390..00000000000 --- a/packages/flutter/test/widget/scrollable_fling_test.dart +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -import 'package:flutter_test/flutter_test.dart'; -import 'package:flutter/widgets.dart'; - -void main() { - testWidgets('fling and tap', (WidgetTester tester) async { - List log = []; - - List textWidgets = []; - for (int i = 0; i < 250; i++) - textWidgets.add(new GestureDetector(onTap: () { log.add('tap $i'); }, child: new Text('$i'))); - await tester.pumpWidget(new Block(children: textWidgets)); - - expect(log, equals([])); - await tester.tap(find.byType(Scrollable)); - await tester.pump(const Duration(milliseconds: 50)); - expect(log, equals(['tap 18'])); - await tester.fling(find.byType(Scrollable), new Offset(0.0, -200.0), 1000.0); - await tester.pump(const Duration(milliseconds: 50)); - expect(log, equals(['tap 18'])); - await tester.tap(find.byType(Scrollable)); - await tester.pump(const Duration(milliseconds: 50)); - expect(log, equals(['tap 18'])); - }); -}