Repository: flutter
Issue: When CupertinoPageScaffold is placed inside CupertinoTabScaffold, their resizeToAvoidBottomInset attributes stack and cause visual bugs with the navigation bar when the onscreen keyboard is present
Labels: platform-ios,framework,f: cupertino,has reproducible steps,P2,found in release: 3.3,found in release: 3.6,team-ios,triaged-ios

When `CupertinoPageScaffold` is placed inside `CupertinoTabScaffold`, their `resizeToAvoidBottomInset` attributes stack and cause visual bugs with the navigation bar when the onscreen keyboard is present.

~~The workaround is setting the `resizeToAvoidBottomInset` of the `CupertinoPageScaffold` or `CupertinoTabScaffold` (whichever makes more sense) to false, but I wish Flutter could handle this automatically.~~ (This causes other visual bugs.)

Seems to be related to #28213.

Here's a gif to illustrate the problem:
1. When `Navigator.push()`-ing, the custom back button on the second page is mispositioned during the animation, it goes back to its normal position after the animation is complete.
2. When `Navigator.pop()`-ing, the navigation bar on the first page (colored in red) does not appear until the animation is complete.
![with-keyboard](https://user-images.githubusercontent.com/2262/83335208-a781df80-a2dd-11ea-9311-5c4d08f8758a.gif)

Note that the bug doesn't happen if you don't use the onscreen keyboard (press ⌘K to dismiss the onscreen keyboard):
![without-keyboard](https://user-images.githubusercontent.com/2262/83335211-ac469380-a2dd-11ea-9e42-e7a129b3701e.gif)

<details>
  <summary>Minimal runnable reproduction as lib/main.dart</summary>

```
import 'package:flutter/cupertino.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return CupertinoApp(
      title: 'TestApp',
      home: HomePage()
    );
  }
}

class HomePage extends StatefulWidget {

  @override
  _HomePageState createState() => _HomePageState();

}

class _HomePageState extends State<HomePage> {

  @override
  Widget build(BuildContext context) {
    return CupertinoTabScaffold(
      tabBar: CupertinoTabBar(
        items: [
          BottomNavigationBarItem(icon: Container(), title: Text('Tab 1')),
          BottomNavigationBarItem(icon: Container(), title: Text('Tab 2'))
        ]
      ),
      tabBuilder: (context, index) {
        return CupertinoTabView(
          builder: (context) => FirstPage()
        );
      }
    );
  }

}

class FirstPage extends StatefulWidget {

  @override
  _FirstPageState createState() => _FirstPageState();

}

class _FirstPageState extends State<FirstPage> {

  @override
  Widget build(BuildContext context) {
    return CupertinoPageScaffold(
      navigationBar: CupertinoNavigationBar(
        backgroundColor: Color.fromRGBO(255, 160, 160, 1),
        middle: Text('First Page')
      ),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.stretch,
        children: [
          CupertinoTextField(autofocus: true),
          CupertinoButton.filled(
            child: Text('Go to Second Page'),
            onPressed: () {
              Navigator.of(context).push(CupertinoPageRoute(
                builder: (context) => SecondPage()
              ));
            }
          )
        ]
      )
    );
  }

}

class SecondPage extends StatefulWidget {
  @override
  _SecondPageState createState() => _SecondPageState();
}

class _SecondPageState extends State<SecondPage> {

  @override
  Widget build(BuildContext context) {
    return CupertinoPageScaffold(
      navigationBar: CupertinoNavigationBar(
        backgroundColor: Color.fromRGBO(255, 255, 160, 1),
        leading: CupertinoButton(
          padding: EdgeInsets.zero,
          child: Text('Custom Button'),
          onPressed: () { Navigator.of(context).pop(); }
        ),
        middle: Text('Second Page')
      ),
      child: Container()
    );
  }

}
```

</details>

<details>
  <summary>Output of running flutter doctor -v</summary>

```
[✓] Flutter (Channel beta, 1.18.0-11.1.pre, on Mac OS X 10.15.5 19F96, locale en-US)
    • Flutter version 1.18.0-11.1.pre at /usr/local/flutter
    • Framework revision 2738a1148b (2 weeks ago), 2020-05-13 15:24:36 -0700
    • Engine revision ef9215ceb2
    • Dart version 2.9.0 (build 2.9.0-8.2.beta)

 
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at /Users/zhenyi/Library/Android/sdk
    • Platform android-28, build-tools 28.0.3
    • Java binary at: /Users/zhenyi/Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.5)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.5, Build version 11E608c
    • CocoaPods version 1.9.1

[✓] Android Studio (version 3.6)
    • Android Studio at /Users/zhenyi/Applications/Android Studio.app/Contents
    • Flutter plugin version 45.1.1
    • Dart plugin version 192.8052
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)

[✓] VS Code (version 1.45.1)
    • VS Code at /Users/zhenyi/Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.10.2

[!] Connected device
    ! No devices available

! Doctor found issues in 1 category.
```

</details>