Repository: flutter
Issue: [webview_flutter][ios]the boundary of webview and flutter has a  lines flashing when cover with dialog an switch form background
Labels: platform-ios,a: platform-views,p: webview,package,e: OS-version specific,has reproducible steps,P2,found in release: 2.10,found in release: 2.11,team-ios,triaged-ios

<!-- 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
-->

## Test results: 
iPhone 13 iOS 15.0 simulator could not reproduce it 
iPhone 13 iOS 15.2 simulator could reproduce it  ❌
iPhoneXR (mobile)  15.0 could reproduce it   ❌

## Steps to Reproduce

- Run code sample 
- The click the right action button produce a bottom dialog cover the webview and container
- Enter background an foreground
 
**Expected results:** <!-- what did you want to see? -->

No lines flashing on the boundary of webview and flutter widget when it cover with dialog and switch from background

**Actual results:** <!-- what did you see? -->

The is a lines flash on the boundary of webview and flutter widget

<details>
<summary>Code sample</summary>

```dart
import 'dart:ui';
import 'package:flutter/material.dart';
import 'package:webview_flutter/webview_flutter.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({Key? key, required this.title}) : super(key: key);
  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    print('_MyHomePageState build');
    return Scaffold(
      appBar: CustomNaviBar(
        appBar: AppBar(
          title: Text(widget.title),
          backgroundColor: Colors.white,
          actions: [
            TextButton(
              onPressed: () {
                showModalBottomSheet(
                  context: context,
                  builder: (context) {
                    return Column(
                      children: [
                        const Padding(
                          padding: EdgeInsets.all(16.0),
                          child: Text('share'),
                        ),
                        Padding(
                          padding: const EdgeInsets.all(16.0),
                          child: Wrap(
                            children: [
                              TextButton(
                                onPressed: () {
                                  // launch('https://flutter.dev');
                                },
                                child: const Text('safari'),
                              )
                            ],
                          ),
                        ),
                      ],
                    );
                  },
                );
              },
              child: const Text('share'),
            )
          ],
          bottom: const NaviBarDivider(),
        ),
      ),
      body: Container(
        key: const Key('key'),
        child: Column(
          children: [
            Container(
              height: 20,
              child: Text('padding 20'),
            ),
            const SizedBox(
              height: 300,
              child: WebView(
                initialUrl: 'https://flutter.dev',
              ),
            ),
          ],
        ),
      ),
    );
  }
}

class CustomNaviBar extends StatelessWidget with PreferredSizeWidget {
  final PreferredSizeWidget appBar;
  const CustomNaviBar({Key? key, required this.appBar}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return appBar;
  }

  @override
  Size get preferredSize => const Size.fromHeight(kToolbarHeight + 1.0);
}

class NaviBarDivider extends StatelessWidget with PreferredSizeWidget {
  const NaviBarDivider({
    Key? key,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return const Divider(
      height: 1.0,
      color: Colors.black,
    );
  }

  @override
  Size get preferredSize => const Size.fromHeight(kToolbarHeight + 1.0);
}
```

</details>

<details>
  <summary>Logs</summary>

<!--
      Run your application with `flutter run --verbose` and attach all the
      log output below between the lines with the backticks. If there is an
      exception, please see if the error message includes enough information
      to explain how to solve the issue.
-->

```
The widget not rebuild when change from background to foreground
```

<!--
     Run `flutter analyze` and attach any output of that command below.
     If there are any analysis errors, try resolving them before filing this issue.
-->

```
```

<!-- Finally, paste the output of running `flutter doctor -v` here. -->

```
[✓] Flutter (Channel stable, 2.5.3, on macOS 11.5.1 20G80 darwin-x64, locale
    en-CN)
    • Flutter version 2.5.3 at /Users/qxq4633/flutter_253
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 18116933e7 (3 months ago), 2021-10-15 10:46:35 -0700
    • Engine revision d3ea636dc5
    • Dart version 2.14.4
    • Pub download mirror https://pub.flutter-io.cn
    • Flutter download mirror https://storage.flutter-io.cn

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    • Android SDK at /Users/qxq4633/Library/Android/sdk
    • Platform android-31, build-tools 30.0.2
    • ANDROID_HOME = /Users/qxq4633/Library/Android/sdk
    • Java binary at: /Applications/Android
      Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 13.0, Build version 13A233
    • CocoaPods version 1.11.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2020.3)
    • 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 11.0.10+0-b96-7281165)

[✓] IntelliJ IDEA Community Edition (version 2021.2)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin version 60.1.4
    • Dart plugin version 212.4746.57

[✓] VS Code (version 1.63.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.32.0

[✓] Connected device (3 available)
    • iPhoneXR (mobile)  • 00008020-00011D4122F2002E            • ios
      • iOS 15.0 19A346
    • iPhone 13 (mobile) • 589C03A8-6F47-4BEF-882B-66EA4424A64E • ios
      • com.apple.CoreSimulator.SimRuntime.iOS-15-0 (simulator)
    • Chrome (web)       • chrome                               • web-javascript
      • Google Chrome 97.0.4692.71

• No issues found!
```

</details>


<!--
      Consider also attaching screenshots and/or videos to better
      illustrate the issue.

      You can upload them directly on GitHub.
      Beware that video file size is limited to 10MB.
-->

https://user-images.githubusercontent.com/16632821/150322012-1ad7eb32-d4e1-4b01-bc79-5838bee70a89.MP4