Skip to content
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

Merged
merged 4 commits into from
Nov 16, 2018

Conversation

jslavitz
Copy link
Contributor

Fixes symmetrical bug #14649 for general page back navigation on iPhone X.

Copy link
Member

@xster xster left a 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 ?
Copy link
Member

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)),
Copy link
Member

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(
Copy link
Member

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
Copy link
Member

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',
Copy link
Member

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)),
Copy link
Member

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
Copy link
Member

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))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation here too

@xster
Copy link
Member

xster commented Nov 15, 2018

LGTM. Good work!

@jslavitz jslavitz merged commit 2654850 into flutter:master Nov 16, 2018
@jslavitz jslavitz deleted the nav-fix branch December 3, 2018 22:25
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants