-
Notifications
You must be signed in to change notification settings - Fork 27.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes navigation page back drag area for iPhone X #24375
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -518,13 +519,17 @@ class _CupertinoBackGestureDetectorState<T> extends State<_CupertinoBackGestureD | |||
@override | |||
Widget build(BuildContext context) { | |||
assert(debugCheckHasDirectionality(context)); | |||
double dragAreaWidth = Directionality.of(context) == TextDirection.ltr ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a code comment for what this is about
@override | ||
Widget build(BuildContext context) { | ||
return MediaQuery( | ||
data: const MediaQueryData(padding: EdgeInsets.fromLTRB(40, 0, 0, 0)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure this is useful. You already have a 40 padding in the ancestry (from the app builder), you're overriding it and adding the same 40 px padding back but after the page route and the back swipe detector.
Widget build(BuildContext context) { | ||
return MediaQuery( | ||
data: const MediaQueryData(padding: EdgeInsets.fromLTRB(40, 0, 0, 0)), | ||
child: Container( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this container is useful. You can just use the Center directly.
), | ||
); | ||
|
||
tester |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indents are a bit weird. Maybe:
tester.state(<NavigatorState>(find.byType(Navigator)).push(
CupertinoPageRoute<void>(
title: 'title',
builder: (BuildContext context) {
return Center(child: Text('Page 1'));
},
),
);
tester | ||
.state<NavigatorState>(find.byType(Navigator)) | ||
.push(CupertinoPageRoute<void>( | ||
title: 'title', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need title
Directionality( | ||
textDirection: TextDirection.rtl, | ||
child: MediaQuery( | ||
data: const MediaQueryData(padding: EdgeInsets.fromLTRB(0, 0, 40, 0)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is ok but might be slightly easier to read EdgeInsets.only(right: 40)
await tester.pumpWidget( | ||
CupertinoApp( | ||
builder: (BuildContext context, Widget navigator) { | ||
return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indent
); | ||
|
||
tester | ||
.state<NavigatorState>(find.byType(Navigator)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentation here too
LGTM. Good work! |
Fixes symmetrical bug #14649 for general page back navigation on iPhone X.