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
dc5e1bba
Commit
dc5e1bba
authored
Sep 21, 2016
by
Matt Perry
Committed by
GitHub
Sep 21, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Disallow back gestures during a page transition. (#5982)
Fixes
https://github.com/flutter/flutter/issues/5973
parent
20d554c1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
0 deletions
+48
-0
page.dart
packages/flutter/lib/src/material/page.dart
+2
-0
page_transitions_test.dart
packages/flutter/test/widget/page_transitions_test.dart
+46
-0
No files found.
packages/flutter/lib/src/material/page.dart
View file @
dc5e1bba
...
...
@@ -202,6 +202,8 @@ class MaterialPageRoute<T> extends PageRoute<T> {
@override
NavigationGestureController
startPopGesture
(
NavigatorState
navigator
)
{
if
(
controller
.
status
!=
AnimationStatus
.
completed
)
return
null
;
assert
(
_backGestureController
==
null
);
_backGestureController
=
new
_CupertinoBackGestureController
(
navigator:
navigator
,
...
...
packages/flutter/test/widget/page_transitions_test.dart
View file @
dc5e1bba
...
...
@@ -286,4 +286,50 @@ void main() {
expect
(
settingsOffset
.
x
,
greaterThan
(
100.0
));
expect
(
settingsOffset
.
y
,
100.0
);
});
testWidgets
(
'Check back gesture doesnt start during transitions'
,
(
WidgetTester
tester
)
async
{
GlobalKey
containerKey1
=
new
GlobalKey
();
GlobalKey
containerKey2
=
new
GlobalKey
();
final
Map
<
String
,
WidgetBuilder
>
routes
=
<
String
,
WidgetBuilder
>{
'/'
:
(
_
)
=>
new
Scaffold
(
key:
containerKey1
,
body:
new
Text
(
'Home'
)),
'/settings'
:
(
_
)
=>
new
Scaffold
(
key:
containerKey2
,
body:
new
Text
(
'Settings'
)),
};
await
tester
.
pumpWidget
(
new
MaterialApp
(
routes:
routes
,
theme:
new
ThemeData
(
platform:
TargetPlatform
.
iOS
),
));
Navigator
.
pushNamed
(
containerKey1
.
currentContext
,
'/settings'
);
await
tester
.
pump
();
await
tester
.
pump
(
const
Duration
(
milliseconds:
100
));
// We are mid-transition, both pages are on stage.
expect
(
find
.
text
(
'Home'
),
isOnstage
);
expect
(
find
.
text
(
'Settings'
),
isOnstage
);
// Drag from left edge to invoke the gesture. (near bottom so we grab
// the Settings page as it comes up).
TestGesture
gesture
=
await
tester
.
startGesture
(
new
Point
(
5.0
,
550.0
));
await
gesture
.
moveBy
(
new
Offset
(
500.0
,
0.0
));
await
gesture
.
up
();
await
tester
.
pump
();
await
tester
.
pump
(
const
Duration
(
milliseconds:
1000
));
// The original forward navigation should have completed, instead of the
// back gesture, since we were mid transition.
expect
(
find
.
text
(
'Home'
),
findsNothing
);
expect
(
find
.
text
(
'Settings'
),
isOnstage
);
// Try again now that we're settled.
gesture
=
await
tester
.
startGesture
(
new
Point
(
5.0
,
550.0
));
await
gesture
.
moveBy
(
new
Offset
(
500.0
,
0.0
));
await
gesture
.
up
();
await
tester
.
pump
();
await
tester
.
pump
(
const
Duration
(
milliseconds:
1000
));
expect
(
find
.
text
(
'Home'
),
isOnstage
);
expect
(
find
.
text
(
'Settings'
),
findsNothing
);
});
}
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