Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
766eda6b
Commit
766eda6b
authored
Nov 02, 2015
by
Hans Muller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Restored BottomSheet dismiss tap
parent
a0c8a4c6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
66 additions
and
16 deletions
+66
-16
bottom_sheet.dart
packages/flutter/lib/src/material/bottom_sheet.dart
+19
-16
bottom_sheet_test.dart
packages/unit/test/widget/bottom_sheet_test.dart
+47
-0
No files found.
packages/flutter/lib/src/material/bottom_sheet.dart
View file @
766eda6b
...
...
@@ -68,23 +68,26 @@ class _BottomSheetState extends State<_BottomSheet> {
}
Widget
build
(
BuildContext
context
)
{
return
new
BuilderTransition
(
performance:
config
.
route
.
_performance
,
variables:
<
AnimatedValue
<
double
>>[
_layout
.
childTop
],
builder:
(
BuildContext
context
)
{
return
new
ClipRect
(
child:
new
CustomOneChildLayout
(
delegate:
_layout
,
token:
_layout
.
childTop
.
value
,
child:
new
GestureDetector
(
onVerticalDragStart:
_handleDragStart
,
onVerticalDragUpdate:
_handleDragUpdate
,
onVerticalDragEnd:
_handleDragEnd
,
child:
new
Material
(
child:
config
.
route
.
child
)
return
new
GestureDetector
(
onTap:
()
{
Navigator
.
of
(
context
).
pop
();
},
child:
new
BuilderTransition
(
performance:
config
.
route
.
_performance
,
variables:
<
AnimatedValue
<
double
>>[
_layout
.
childTop
],
builder:
(
BuildContext
context
)
{
return
new
ClipRect
(
child:
new
CustomOneChildLayout
(
delegate:
_layout
,
token:
_layout
.
childTop
.
value
,
child:
new
GestureDetector
(
onVerticalDragStart:
_handleDragStart
,
onVerticalDragUpdate:
_handleDragUpdate
,
onVerticalDragEnd:
_handleDragEnd
,
child:
new
Material
(
child:
config
.
route
.
child
)
)
)
)
);
}
)
;
}
)
);
}
}
...
...
packages/unit/test/widget/bottom_sheet_test.dart
0 → 100644
View file @
766eda6b
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
);
});
});
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment