Commit 766eda6b authored by Hans Muller's avatar Hans Muller

Restored BottomSheet dismiss tap

parent a0c8a4c6
...@@ -68,23 +68,26 @@ class _BottomSheetState extends State<_BottomSheet> { ...@@ -68,23 +68,26 @@ class _BottomSheetState extends State<_BottomSheet> {
} }
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new BuilderTransition( return new GestureDetector(
performance: config.route._performance, onTap: () { Navigator.of(context).pop(); },
variables: <AnimatedValue<double>>[_layout.childTop], child: new BuilderTransition(
builder: (BuildContext context) { performance: config.route._performance,
return new ClipRect( variables: <AnimatedValue<double>>[_layout.childTop],
child: new CustomOneChildLayout( builder: (BuildContext context) {
delegate: _layout, return new ClipRect(
token: _layout.childTop.value, child: new CustomOneChildLayout(
child: new GestureDetector( delegate: _layout,
onVerticalDragStart: _handleDragStart, token: _layout.childTop.value,
onVerticalDragUpdate: _handleDragUpdate, child: new GestureDetector(
onVerticalDragEnd: _handleDragEnd, onVerticalDragStart: _handleDragStart,
child: new Material(child: config.route.child) onVerticalDragUpdate: _handleDragUpdate,
onVerticalDragEnd: _handleDragEnd,
child: new Material(child: config.route.child)
)
) )
) );
); }
} )
); );
} }
} }
......
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:test/test.dart';
import 'widget_tester.dart';
void main() {
test('Verify that a tap dismisses the BottomSheet', () {
testWidgets((WidgetTester tester) {
BuildContext context;
tester.pumpWidget(new MaterialApp(
routes: <String, RouteBuilder>{
'/': (RouteArguments args) {
context = args.context;
return new Container();
}
}
));
tester.pump();
expect(tester.findText('BottomSheet'), isNull);
showModalBottomSheet(context: context, child: new Text('BottomSheet'));
tester.pump(); // bottom sheet show animation starts
tester.pump(new Duration(seconds: 1)); // animation done
expect(tester.findText('BottomSheet'), isNotNull);
// Tap on the the bottom sheet itself to dismiss it
tester.tap(tester.findText('BottomSheet'));
tester.pump(); // bottom sheet dismiss animation starts
tester.pump(new Duration(seconds: 1)); // animation done
expect(tester.findText('BottomSheet'), isNull);
showModalBottomSheet(context: context, child: new Text('BottomSheet'));
tester.pump(); // bottom sheet show animation starts
tester.pump(new Duration(seconds: 1)); // animation done
expect(tester.findText('BottomSheet'), isNotNull);
// Tap above the the bottom sheet to dismiss it
tester.tapAt(new Point(20.0, 20.0));
tester.pump(); // bottom sheet dismiss animation starts
tester.pump(new Duration(seconds: 1)); // animation done
expect(tester.findText('BottomSheet'), isNull);
});
});
}
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