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
26548503
Unverified
Commit
26548503
authored
Nov 16, 2018
by
jslavitz
Committed by
GitHub
Nov 16, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes navigation page back drag area for iPhone X (#24375)
* nav fix and test
parent
b3d9fb4d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
100 additions
and
1 deletion
+100
-1
route.dart
packages/flutter/lib/src/cupertino/route.dart
+8
-1
page_test.dart
packages/flutter/test/cupertino/page_test.dart
+92
-0
No files found.
packages/flutter/lib/src/cupertino/route.dart
View file @
26548503
...
...
@@ -3,6 +3,7 @@
// found in the LICENSE file.
import
'dart:async'
;
import
'dart:math'
;
import
'package:flutter/foundation.dart'
;
import
'package:flutter/gestures.dart'
;
...
...
@@ -518,13 +519,19 @@ class _CupertinoBackGestureDetectorState<T> extends State<_CupertinoBackGestureD
@override
Widget
build
(
BuildContext
context
)
{
assert
(
debugCheckHasDirectionality
(
context
));
// For devices with notches, the drag area needs to be larger on the side
// that has the notch.
double
dragAreaWidth
=
Directionality
.
of
(
context
)
==
TextDirection
.
ltr
?
MediaQuery
.
of
(
context
).
padding
.
left
:
MediaQuery
.
of
(
context
).
padding
.
right
;
dragAreaWidth
=
max
(
dragAreaWidth
,
_kBackGestureWidth
);
return
Stack
(
fit:
StackFit
.
passthrough
,
children:
<
Widget
>[
widget
.
child
,
PositionedDirectional
(
start:
0.0
,
width:
_kBackGesture
Width
,
width:
dragArea
Width
,
top:
0.0
,
bottom:
0.0
,
child:
Listener
(
...
...
packages/flutter/test/cupertino/page_test.dart
View file @
26548503
...
...
@@ -265,6 +265,98 @@ void main() {
expect
(
find
.
text
(
'Page 2'
),
isOnstage
);
});
testWidgets
(
'test edge swipes work with media query padding (LTR)'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
CupertinoApp
(
builder:
(
BuildContext
context
,
Widget
navigator
)
{
return
MediaQuery
(
data:
const
MediaQueryData
(
padding:
EdgeInsets
.
only
(
left:
40
)),
child:
navigator
,
);
},
home:
const
Placeholder
(),
),
);
tester
.
state
<
NavigatorState
>(
find
.
byType
(
Navigator
)).
push
(
CupertinoPageRoute
<
void
>(
builder:
(
BuildContext
context
)
=>
const
Center
(
child:
Text
(
'Page 1'
)),
),
);
await
tester
.
pump
();
await
tester
.
pump
(
const
Duration
(
milliseconds:
400
));
tester
.
state
<
NavigatorState
>(
find
.
byType
(
Navigator
)).
push
(
CupertinoPageRoute
<
void
>(
builder:
(
BuildContext
context
)
=>
const
Center
(
child:
Text
(
'Page 2'
)),
),
);
await
tester
.
pump
();
await
tester
.
pump
(
const
Duration
(
milliseconds:
400
));
expect
(
find
.
text
(
'Page 1'
),
findsNothing
);
expect
(
find
.
text
(
'Page 2'
),
isOnstage
);
// Now drag from the left edge.
final
TestGesture
gesture
=
await
tester
.
startGesture
(
const
Offset
(
35.0
,
200.0
));
await
gesture
.
moveBy
(
const
Offset
(
300.0
,
0.0
));
await
tester
.
pump
();
await
tester
.
pumpAndSettle
();
// Page 1 is now visible.
expect
(
find
.
text
(
'Page 1'
),
isOnstage
);
expect
(
find
.
text
(
'Page 2'
),
isOnstage
);
});
testWidgets
(
'test edge swipes work with media query padding (RLT)'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
CupertinoApp
(
builder:
(
BuildContext
context
,
Widget
navigator
)
{
return
Directionality
(
textDirection:
TextDirection
.
rtl
,
child:
MediaQuery
(
data:
const
MediaQueryData
(
padding:
EdgeInsets
.
only
(
right:
40
)),
child:
navigator
,
),
);
},
home:
const
Placeholder
(),
),
);
tester
.
state
<
NavigatorState
>(
find
.
byType
(
Navigator
)).
push
(
CupertinoPageRoute
<
void
>(
builder:
(
BuildContext
context
)
=>
const
Center
(
child:
Text
(
'Page 1'
)),
),
);
await
tester
.
pump
();
await
tester
.
pump
(
const
Duration
(
milliseconds:
400
));
tester
.
state
<
NavigatorState
>(
find
.
byType
(
Navigator
)).
push
(
CupertinoPageRoute
<
void
>(
builder:
(
BuildContext
context
)
=>
const
Center
(
child:
Text
(
'Page 2'
)),
),
);
await
tester
.
pump
();
await
tester
.
pump
(
const
Duration
(
milliseconds:
400
));
expect
(
find
.
text
(
'Page 1'
),
findsNothing
);
expect
(
find
.
text
(
'Page 2'
),
isOnstage
);
// Now drag from the left edge.
final
TestGesture
gesture
=
await
tester
.
startGesture
(
const
Offset
(
765.0
,
200.0
));
await
gesture
.
moveBy
(
const
Offset
(-
300.0
,
0.0
));
await
tester
.
pump
();
await
tester
.
pumpAndSettle
();
// Page 1 is now visible.
expect
(
find
.
text
(
'Page 1'
),
isOnstage
);
expect
(
find
.
text
(
'Page 2'
),
isOnstage
);
});
testWidgets
(
'test only edge swipes work (RTL)'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
CupertinoApp
(
...
...
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