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
52e90669
Commit
52e90669
authored
Nov 20, 2015
by
Ian Hickson
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #520 from Hixie/yak3-didPop
OverlayRoute.finished()
parents
5722c96b
2e0e6aa4
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
11 deletions
+22
-11
bottom_sheet.dart
packages/flutter/lib/src/material/bottom_sheet.dart
+3
-7
drawer.dart
packages/flutter/lib/src/material/drawer.dart
+4
-2
routes.dart
packages/flutter/lib/src/widgets/routes.dart
+13
-1
bottom_sheet_test.dart
packages/unit/test/widget/bottom_sheet_test.dart
+2
-1
No files found.
packages/flutter/lib/src/material/bottom_sheet.dart
View file @
52e90669
...
...
@@ -153,16 +153,12 @@ class _ModalBottomSheetRoute extends OverlayRoute {
super
.
didPush
(
overlay
,
insertionPoint
);
}
void
_finish
(
dynamic
result
)
{
super
.
didPop
(
result
);
// clear the overlay entries
completer
.
complete
(
result
);
}
void
didPop
(
dynamic
result
)
{
completer
.
complete
(
result
);
if
(
performance
.
isDismissed
)
_finish
(
result
);
finished
(
);
else
performance
.
reverse
().
then
((
_
)
{
_finish
(
result
);
});
performance
.
reverse
().
then
((
_
)
{
finished
(
);
});
}
Widget
_buildModalBarrier
(
BuildContext
context
)
{
...
...
packages/flutter/lib/src/material/drawer.dart
View file @
52e90669
...
...
@@ -74,7 +74,7 @@ class _DrawerRoute extends OverlayRoute {
Navigator
.
of
(
context
).
pop
();
break
;
case
_DrawerState
.
popped
:
super
.
didPop
(
null
);
finished
(
);
break
;
case
_DrawerState
.
closed
:
assert
(
false
);
...
...
@@ -87,6 +87,8 @@ class _DrawerRoute extends OverlayRoute {
}
void
didPop
(
dynamic
result
)
{
// we don't call the superclass because we want to control the timing of the
// call to finished().
switch
(
_state
)
{
case
_DrawerState
.
showing
:
_drawerKey
.
currentState
?.
_close
();
...
...
@@ -96,7 +98,7 @@ class _DrawerRoute extends OverlayRoute {
assert
(
false
);
break
;
case
_DrawerState
.
closed
:
super
.
didPop
(
null
);
finished
(
);
break
;
}
}
...
...
packages/flutter/lib/src/widgets/routes.dart
View file @
52e90669
...
...
@@ -45,7 +45,19 @@ abstract class OverlayRoute extends Route {
}
}
// Subclasses shouldn't call this if they want to delay the finished() call.
void
didPop
(
dynamic
result
)
{
finished
();
}
/// Clears out the overlay entries.
///
/// This method is intended to be used by subclasses who don't call
/// super.didPop() because they want to have control over the timing of the
/// overlay removal.
///
/// Do not call this method outside of this context.
void
finished
()
{
for
(
OverlayEntry
entry
in
_overlayEntries
)
entry
.
remove
();
_overlayEntries
.
clear
();
...
...
@@ -84,7 +96,7 @@ abstract class TransitionRoute extends OverlayRoute {
overlayEntries
.
first
.
opaque
=
false
;
break
;
case
PerformanceStatus
.
dismissed
:
super
.
didPop
(
_result
);
// clear the overlays
super
.
finished
(
);
// clear the overlays
completer
?.
complete
(
_result
);
break
;
}
...
...
packages/unit/test/widget/bottom_sheet_test.dart
View file @
52e90669
...
...
@@ -36,13 +36,14 @@ void main() {
tester
.
pump
();
// bottom sheet show animation starts
tester
.
pump
(
new
Duration
(
seconds:
1
));
// animation done
expect
(
tester
.
findText
(
'BottomSheet'
),
isNotNull
);
expect
(
showBottomSheetThenCalled
,
isFalse
);
// Tap on the the bottom sheet itself to dismiss it
tester
.
tap
(
tester
.
findText
(
'BottomSheet'
));
tester
.
pump
();
// bottom sheet dismiss animation starts
expect
(
showBottomSheetThenCalled
,
isTrue
);
tester
.
pump
(
new
Duration
(
seconds:
1
));
// last frame of animation (sheet is entirely off-screen, but still present)
tester
.
pump
(
new
Duration
(
seconds:
1
));
// frame after the animation (sheet has been removed)
expect
(
showBottomSheetThenCalled
,
isTrue
);
expect
(
tester
.
findText
(
'BottomSheet'
),
isNull
);
showModalBottomSheet
(
context:
context
,
builder:
(
BuildContext
context
)
=>
new
Text
(
'BottomSheet'
));
...
...
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