Repository: flutter
Issue: PageStorageKey with TabBarView causes PageController and TabController to get out of sync
Labels: framework,f: material design,has reproducible steps,P2,found in release: 3.7,found in release: 3.9,team-design,triaged-design

`TabBarView` uses the `index` of its `tabController` to set the `initialPage` of its `PageController`. However, the `PageController` can later determine a different `_pageToUseOnStartup` using its `PageStorage`. There's no mechanism currently in place for the `TabBarView` to notify its `tabController` that the `PageController` has decided to start up on a different page.

The result is that you can have a `TabBar` that doesn't match its `TabBarView`, even though they share a common `TabController`. This seems like a bug.

![untitled 1](https://user-images.githubusercontent.com/394889/27542909-7fcca966-5a3d-11e7-97eb-ce00bac4a3d6.gif)

```dart
import 'dart:async';
import 'package:flutter/material.dart';

void main() {
  runApp(new MaterialApp(
    home: new MyHomePage(),
  ));
}

class MyHomePage extends StatefulWidget {
  _MyHomePageState createState() => new _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> with TickerProviderStateMixin {
  PageController _controller = new PageController();

  Widget build(BuildContext context) {
    return new Scaffold(
      body: new PageView(
        controller: _controller,
        children: <Widget>[
          new DefaultTabController(
            length: 2,
            child: new Column(
              children: <Widget>[
                new Container(
                  height: 200.0,
                  child: new Center(
                    child: new Text('Swipe here'),
                  ),
                ),
                new Container(
                  height: 100.0,
                  color: Colors.grey,
                  child: new TabBar(
                    key: new PageStorageKey<Type>(TabBar),
                    tabs: <Widget>[
                      new Tab(text: 'Green'),
                      new Tab(text: 'Red'),
                    ],
                  ),
                ),
                new Expanded(
                  child: new TabBarView(
                    key: new PageStorageKey<Type>(TabBarView),
                    children: [
                      new Container(color: Colors.green),
                      new Container(color: Colors.red),
                    ],
                  ),
                ),
              ],
            ),
          ),
          new Center(
            child: new Text('Ok now swipe back'),
          ),
        ],
      ),
    );
  }
}
```

## Flutter Doctor
```
[✓] Flutter (on Mac OS X 10.12.4 16E195, locale en-US, channel master)
    • Flutter at /Users/jackson/git/flutter
    • Framework revision c5999c74c0 (2 hours ago), 2017-06-26 12:47:43 +0200
    • Engine revision 8a2d337446
    • Tools Dart version 1.24.0

[✓] Android toolchain - develop for Android devices (Android SDK 25.0.3)
    • Android SDK at /Users/jackson/Library/Android/sdk/
    • Platform android-25, build-tools 25.0.3
    • ANDROID_HOME = /Users/jackson/Library/Android/sdk/
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_112-release-b06)

[✓] iOS toolchain - develop for iOS devices (Xcode 8.3.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 8.3.3, Build version 8E3004b, 
    • ios-deploy 1.9.1
    • CocoaPods version 1.2.1

[✓] Android Studio (version 2.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Gradle version 3.2
    • Java version OpenJDK Runtime Environment (build 1.8.0_112-release-b06)

[✓] IntelliJ IDEA Community Edition (version 2017.1.3)
    • Flutter plugin version 14.0
    • Dart plugin version 171.4424.63

[✓] Connected devices
    • iPhone 7 Plus • F8A917C4-9848-49C2-8F0D-664B49E0B635 • ios • iOS 10.3 (simulator)
```