Repository: flutter
Issue: [iOS][Web] Wrong behavior when keyboard opens: Layout is changed or TextField disappears
Labels: a: text input,platform-web,has reproducible steps,P2,browser: safari-ios,team-web,triaged-web,found in release: 3.13,found in release: 3.16

### Is there an existing issue for this?

- [X] I have searched the [existing issues](https://github.com/flutter/flutter/issues)
- [X] I have read the [guide to filing a bug](https://flutter.dev/docs/resources/bug-reports)

### Steps to reproduce

The best way to reproduce this bug is to use `BottomSheet` with `TextField`.
But, as I see, this bug can be reproduce with any keyboard appearance.

Install Flutter Web App on iPhone.
1. Open bottom sheet with `TextField`.
2. Open keyboard.

Sometimes it's open fine, page below shown as it should be, and bottom sheet also has right insets.
But sometimes it's looks like whole screen of the app is jumping out of viewport, in this case we have wrong insets and paddings.

We can reopen keyboard few times and get different result each time.

On bottom sheet screenshots we can see, that FAB is can be on right place on bottom right, or jump somewhere up.
Also, on simple screenshots we can see some white space from bottom to the `TextField`, that's looks wrong.

I've found this issue with same problem: https://github.com/flutter/flutter/issues/42211
But it's close and mark as done with Safari 13+.
My iOS is 16.6, so or this bug is not fixed, or it's back.

### Expected results

Right view insets and padding.
Page stay on it's place.
Bottom Sheet shown right.

### Actual results

View insets is wrong, page is like go out of it viewport.
Bottom sheet also jump out.

### Code sample

<details><summary>Bottom sheet example</summary>

```dart
import 'package:flutter/material.dart';

void main() {
  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,
        primarySwatch: Colors.blue,
      ),
      home: const Screen(),
    );
  }
}

class Screen extends StatelessWidget {
  const Screen({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('AppBar'),
      ),
      body: const Text('123'),
      floatingActionButton: FloatingActionButton(
        onPressed: () {
          showModalBottomSheet(
            context: context,
            useSafeArea: true,
            builder: (context) {
              return const TextField(
                autofocus: true,
              );
            },
          );
        },
      ),
    );
  }
}

```

</details>

<details><summary>Simple example</summary>

```dart
import 'package:flutter/material.dart';

void main() {
  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,
        primarySwatch: Colors.blue,
      ),
      home: const Screen(),
    );
  }
}

class Screen extends StatelessWidget {
  const Screen({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('AppBar'),
      ),
      body: ListView(
        children: [
          for (int i = 0; i < 20; i++) const Text('123'),
          const TextField(),
          for (int i = 0; i < 20; i++) const Text('123'),
        ],
      ),
    );
  }
}
```

</details>


### Screenshots or Video

<details>
<summary>Bottom sheet screenshots</summary>

![IMG_0112](https://github.com/flutter/flutter/assets/1605761/ae16e820-0db0-4768-afe8-ee33cef15948)
![IMG_0113](https://github.com/flutter/flutter/assets/1605761/f22bac09-0632-4e50-a6fc-e656c63aadb0)

</details>

<details>
<summary>Simple screenshot</summary>

![IMG_0114](https://github.com/flutter/flutter/assets/1605761/00e6c632-c236-4e0f-abc5-2bf4b635adb4)
![IMG_0115](https://github.com/flutter/flutter/assets/1605761/69d44065-33c2-4c99-b6e1-32c52b41c013)


</details>


### Logs

_No response_

### Flutter Doctor output

<details><summary>Doctor output</summary>

```console
[✓] Flutter (Channel stable, 3.13.6, on macOS 14.0 23A344 darwin-arm64, locale ru-RU)
    • Flutter version 3.13.6 on channel stable at /Users/vorkytaka/fvm/versions/3.13.6
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision ead455963c (3 дня назад), 2023-09-26 18:28:17 -0700
    • Engine revision a794cf2681
    • Dart version 3.1.3
    • DevTools version 2.25.0

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at /Users/vorkytaka/Library/Android/sdk
    • Platform android-33, build-tools 33.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.3.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14E300c
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.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 11.0.15+0-b2043.56-8887301)

[✓] VS Code (version 1.82.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.72.0

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-arm64   • macOS 14.0 23A344 darwin-arm64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 117.0.5938.92

[✓] Network resources
    • All expected network resources are available.

• No issues found!
```

</details>