Repository: flutter
Issue: [webview_flutter] [android] flickering background in pageView
Labels: c: regression,platform-android,p: webview,package,has reproducible steps,P2,found in release: 3.0,found in release: 3.1,team-android,triaged-android

<!-- Thank you for using Flutter!

     If you are looking for support, please check out our documentation
     or consider asking a question on Stack Overflow:
      * https://flutter.dev/
      * https://api.flutter.dev/
      * https://stackoverflow.com/questions/tagged/flutter?sort=frequent

     If you have found a bug or if our documentation doesn't have an answer
     to what you're looking for, then fill out the template below. Please read
     our guide to filing a bug first: https://flutter.dev/docs/resources/bug-reports
-->

## Steps to Reproduce

<!-- Please include full steps to reproduce so that we can reproduce the problem. -->

1. Execute `flutter run` on the code sample <!-- (see "Code sample" section below) -->
2. Then change bottom navigation index.
3. Before next webView page, It will occur flickering background(initial page's color or black) for a few frames.

**Record:** 

| stable 2.10.3 | stable 3.0.1|
| -- | -- | 
| <video src="https://user-images.githubusercontent.com/46276533/172796094-e94765e2-b2c7-483e-a7ed-877fb313b984.mov" /> | <video src="https://user-images.githubusercontent.com/46276533/172803673-f3a6aedb-0c27-4ca2-83b8-b57e9b1497c3.mov"/> |



**Expected results:** <!-- what did you want to see? -->
Change pageView without flickering


 [example repo](https://github.com/Heewookji/webview-bug)

<details>
<summary>Code sample</summary>

<!--
      Please create a minimal reproducible sample that shows the problem
      and attach it below between the lines with the backticks.

      To create it you can use `flutter create bug` command and update the `main.dart` file.

      Alternatively, you can use https://dartpad.dev/
      which is capable of creating and running small Flutter apps.

      Without this we will unlikely be able to progress on the issue, and because of that
      we regretfully will have to close it.
-->

```dart
import 'package:flutter/material.dart';
import 'package:webview_flutter/webview_flutter.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  late final Future _navigateToHome;
  final _navigatorKey = GlobalKey<NavigatorState>();

  NavigatorState get _navigator => _navigatorKey.currentState!;

  @override
  void initState() {
    super.initState();
    _navigateToHome = Future.delayed(
      const Duration(seconds: 2),
      () => _navigator.pushNamedAndRemoveUntil(
        MyHomePage.routeName,
        (route) => false,
      ),
    );
  }

  @override
  Widget build(BuildContext context) {
    return FutureBuilder(
      future: _navigateToHome,
      builder: (context, snapshot) {
        return MaterialApp(
          initialRoute: SplashPage.routeName,
          navigatorKey: _navigatorKey,
          onGenerateRoute: (settings) {
            switch (settings.name) {
              case SplashPage.routeName:
                return MaterialPageRoute(
                  builder: (_) => const SplashPage(),
                  settings: settings,
                );
              default:
                return MaterialPageRoute(
                  builder: (_) => const MyHomePage(),
                  settings: settings,
                );
            }
          },
        );
      },
    );
  }
}

class SplashPage extends StatelessWidget {
  static const String routeName = '/splash';
  const SplashPage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return const Scaffold(
      backgroundColor: Colors.redAccent,
    );
  }
}

class MyHomePage extends StatefulWidget {
  static const String routeName = '/home';
  const MyHomePage({Key? key}) : super(key: key);

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  int currentIndex = 0;
  PageController pageController = PageController();

  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: PageView(
        controller: pageController,
        physics: const NeverScrollableScrollPhysics(),
        children: const [
          WebView(initialUrl: 'https://flutter.dev/'),
          WebView(initialUrl: 'https://flutter.dev/'),
          WebView(initialUrl: 'https://flutter.dev/'),
        ],
      ),
      bottomNavigationBar: BottomNavigationBar(
        onTap: (index) {
          setState(() {
            currentIndex = index;
          });
          pageController.jumpToPage(index);
        },
        currentIndex: currentIndex,
        selectedItemColor: Colors.amber,
        items: const [
          BottomNavigationBarItem(
            icon: Icon(Icons.home),
            label: '1',
            backgroundColor: Colors.blueAccent,
          ),
          BottomNavigationBarItem(
            icon: Icon(Icons.send),
            label: '2',
          ),
          BottomNavigationBarItem(
            icon: Icon(Icons.notifications),
            label: '3',
          ),
        ],
      ),
    );
  }
}
```

</details>

<details>
  <summary>flutter doctor</summary>

<!-- Finally, paste the output of running `flutter doctor -v` here. -->

```
[✓] Flutter (Channel stable, 2.10.3, on macOS 12.3.1 21E258 darwin-x64, locale ko-KR)
    • Flutter version 2.10.3 at /Users/comento/dev/environment/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 7e9793dee1 (3달 전), 2022-03-02 11:23:12 -0600
    • Engine revision bd539267b4
    • Dart version 2.16.1
    • DevTools version 2.9.2

[!] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at /Users/comento/Library/Android/sdk
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.

[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)

[✓] IntelliJ IDEA Ultimate Edition (version 2021.2.4)
    • IntelliJ at /Applications/IntelliJ IDEA.app
    • Flutter plugin version 67.1.2
    • Dart plugin version 212.5744

[✓] VS Code (version 1.67.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.42.0

[✓] Connected device (4 available)
    • SM G973N (mobile)            • R39M3096VWN                          • android-arm64  • Android 11 (API 30)
    • sdk gphone64 x86 64 (mobile) • emulator-5554                        • android-x64    • Android 12 (API 31) (emulator)
    • iPhone 13 (mobile)           • 12FC7D8F-9032-40B2-843F-FDB4083FC8F4 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-15-5
      (simulator)
    • Chrome (web)                 • chrome                               • web-javascript • Google Chrome 102.0.5005.61

[✓] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 1 category.

```

</details>


It may be related to #30111, #27198
It occurs with android OS, both simulator and physical device.
It occurs with flutter version with 2.10.1 and 3.0.1. (but slightly different as recorded above)