Repository: flutter
Issue: [webview_flutter_android] WebView fails to resize in SystemUiMode.edgeToEdge after display size change via system settings
Labels: platform-android,p: webview,package,has reproducible steps,team-android,found in release: 3.27,found in release: 3.28

### Steps to reproduce

1. Lock device orientation in portrait mode
2. Enable SystemUiMode.edgeToEdge
3. Change display size from Settings -> Display -> Display size and text
4. Go back to app

### Expected results

Webview resizes correctly.

### Actual results

Webview does not resize correctly.
Reproducible with Pixel 5 (Android 14), Pixel 3XL (Android 12).

Flutter 3.27.2
webview_flutter: 4.10.0
webview_flutter_android: 4.3.1

### Code sample

<details open><summary>Code sample</summary>

```dart
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:webview_flutter/webview_flutter.dart';
import 'package:webview_flutter_android/webview_flutter_android.dart';

void setSystemMode(SystemUiMode mode) {
  SystemChrome.setEnabledSystemUIMode(mode, overlays: SystemUiOverlay.values);
  SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle.light.copyWith(
    statusBarColor: Colors.transparent,
    systemNavigationBarColor: Colors.transparent,
    systemNavigationBarDividerColor: Colors.transparent,
  ));
}

void main() {
  WidgetsFlutterBinding.ensureInitialized();

  SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
  setSystemMode(SystemUiMode.edgeToEdge);

  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        useMaterial3: true,
      ),
      home: const WebViewExample(),
    );
  }
}

class WebViewExample extends StatefulWidget {
  const WebViewExample({super.key});

  @override
  State<WebViewExample> createState() => _WebViewExampleState();
}

class _WebViewExampleState extends State<WebViewExample> {
  late final WebViewController _webViewController;

  SystemUiMode _uiMode = SystemUiMode.edgeToEdge;

  @override
  void initState() {
    super.initState();

    _webViewController = WebViewController()
      ..setJavaScriptMode(JavaScriptMode.unrestricted)
      ..loadHtmlString("""
        <!DOCTYPE html>
        <html lang="en">
          <head>
            <meta charset="utf-8" />
            <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no,viewport-fit=cover" />
          </head>
          <body style="margin: 0; padding: 0;">
            <div style="height: 100vh; width: 100vw; background-color: red; box-sizing: border-box; border: 10px solid blue;"></div>
          </body>
        </html>
      """);

    AndroidWebViewController.enableDebugging(true);
  }

  @override
  Widget build(BuildContext context) {
    final mq = MediaQuery.sizeOf(context);

    return Scaffold(
      body: SizedBox(
        width: mq.width,
        height: mq.height,
        child: WebViewWidget(controller: _webViewController),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: () {
          _uiMode = _uiMode == SystemUiMode.edgeToEdge
              ? SystemUiMode.manual
              : SystemUiMode.edgeToEdge;

          setSystemMode(_uiMode);
        },
        tooltip: 'Change ui mode',
        child: const Icon(Icons.add),
      ),
    );
  }
}

```

</details>


### Screenshots or Video

<details open>
<summary>Screenshots / Video demonstration</summary>

<img src="https://github.com/user-attachments/assets/9f17d831-5020-4a7f-822f-dfada5d82a81" width ="300"> 

</details>


### Logs

<details open><summary>Logs</summary>

```console
[Paste your logs here]
```

</details>


### Flutter Doctor output

<details open><summary>Doctor output</summary>

```console
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.27.2, on Microsoft Windows [Version 10.0.19045.5371], locale et-EE)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 35.0.1)
[√] Chrome - develop for the web
[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.2.3)
[√] Android Studio (version 2024.2)
[√] IntelliJ IDEA Community Edition (version 2022.1)
[√] VS Code, 64-bit edition (version 1.96.3)
[√] Connected device (3 available)
[√] Network resources
```

</details>