Repository: flutter
Issue: TextField text content disappears
Labels: a: text input,e: device-specific,platform-ios,framework,P2,team-text-input,triaged-text-input

<!-- 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
-->
_This is the translated version of the original issue via google translate_


## Steps to Reproduce

1. Set the `keyboardType` property to `TextInputType.number`.
2. Enter any content, and then keep switching the keyboard display state 
3. After repeating several times, the content of TextField disappears

**Expected results:** <!-- what did you want to see? -->

The content is always displayed unless the content is manually cleared

**Actual results:** <!-- what did you see? -->

The TextField with `keyboardType` is set, and the content disappears when the keyboard display state is switched


<details>
<summary>Original Issue </summary>

#### Steps to Reproduce

<!-- You must include full steps to reproduce so that we can reproduce the problem. -->

1. 设置`keyboardType`属性为`TextInputType.number`.
2. 输入任何内容，然后不断切换键盘显示状态 <!-- include every file that is different from the template app! -->
3. 重复几次以后，TextField内容消失 <!-- describe how to reproduce the problem -->

**Expected results:** <!-- what did you want to see? -->
除非手动清除内容，否则一直显示内容


**Actual results:** <!-- what did you see? -->
设置了`keyboardType`的TextField，切换键盘显示状态时，内容消失

</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.
-->

```
[  +12 ms] executing: xcrun simctl launch 9D89D4DD-4B46-4A6F-999D-BABBB2808A98 com.grasp.ipad --enable-dart-profiling --enable-checked-mode --verify-entry-points --observatory-port=0
[ +187 ms] com.grasp.ipad: 21074
[        ] Waiting for observatory port to be available...
[ +790 ms] Observatory URL on device: http://127.0.0.1:58937/Z-nKVt2YqKc=/
[   +6 ms] Caching compiled dill
[ +184 ms] Connecting to service protocol: http://127.0.0.1:58937/Z-nKVt2YqKc=/
[ +118 ms] Launching a Dart Developer Service (DDS) instance at http://127.0.0.1:0, connecting to VM service at http://127.0.0.1:58937/Z-nKVt2YqKc=/.
[ +362 ms] DDS is listening at http://127.0.0.1:58940/ZVRrXId79lA=/.
[  +44 ms] Successfully connected to service protocol: http://127.0.0.1:58937/Z-nKVt2YqKc=/
[  +12 ms] DevFS: Creating new filesystem on the device (null)
[  +13 ms] DevFS: Created new filesystem on the device (file:///Users/changlei/Library/Developer/CoreSimulator/Devices/9D89D4DD-4B46-4A6F-999D-BABBB2808A98/data/Containers/Data/Application/3CD9FE15-F2D2-4662-88A2-854C45C0567A/tmp/ishop_padCvNM3K/ishop_pad/)
[   +1 ms] Updating assets
[ +170 ms] Manifest contained wildcard assets. Inserting missing file into build graph to force rerun. for more information see #56466.
[   +5 ms] Syncing files to device iPad Pro (11-inch) (3rd generation)...
[   +1 ms] <- reset
[        ] Compiling dart to kernel with 0 updated files
[   +5 ms] <- recompile package:ishop_pad/main.dart 96481e14-02de-4e10-93be-3b057ead7cd7
[        ] <- 96481e14-02de-4e10-93be-3b057ead7cd7
[   +5 ms] Bugly appId: 73b6284637
[ +294 ms] Updating files.
[        ] DevFS: Sync finished
[   +1 ms] Syncing files to device iPad Pro (11-inch) (3rd generation)... (completed in 308ms)
[        ] Synced 0.0MB.
[   +1 ms] <- accept
[   +1 ms] Connected to _flutterView/0x7fa48d849a20.
[   +2 ms] Flutter run key commands.
[   +1 ms] r Hot reload. 🔥🔥🔥
[        ] R Hot restart.
[        ] h List all available interactive commands.
[        ] d Detach (terminate "flutter run" but leave application running).
[        ] c Clear the screen
[        ] q Quit (terminate the application on the device).
[        ] Running with unsound null safety
[        ] For more information see https://dart.dev/null-safety/unsound-null-safety
[        ] An Observatory debugger and profiler on iPad Pro (11-inch) (3rd generation) is available at: http://127.0.0.1:58940/ZVRrXId79lA=/
[ +350 ms] DevTools activation throttled until 2021-09-18 01:03:53.976555.
```

<!--
     Run `flutter analyze` and attach any output of that command below.
     If there are any analysis errors, try resolving them before filing this issue.
-->

```
Analyzing ishop_pad...                                                  
No issues found! (ran in 6.2s)
```

<!-- Finally, paste the output of running `flutter doctor -v` here. -->

```
[✓] Flutter (Channel stable, 2.5.0, on macOS 11.5.2 20G95 darwin-x64, locale zh-Hans-CN)
    • Flutter version 2.5.0 at /Users/changlei/Downloads/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 4cc385b4b8 (9 days ago), 2021-09-07 23:01:49 -0700
    • Engine revision f0826da7ef
    • Dart version 2.14.0
    • 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/changlei/Library/Android/sdk
    • Platform android-30, build-tools 30.0.2
    • ANDROID_HOME = /Users/changlei/Library/Android/sdk
    • Java binary at: /Library/Java/JavaVirtualMachines/jdk-14.0.1.jdk/Contents/Home/bin/java
    • Java version Java(TM) SE Runtime Environment (build 14.0.1+7)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.5.1, Build version 12E507
    • 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 2020.3.2)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin version 203.7759

[✓] VS Code (version 1.58.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.24.0

[✓] Proxy Configuration
    • HTTP_PROXY is set
    • NO_PROXY is localhost,127.0.0.1
    • NO_PROXY contains 127.0.0.1
    • NO_PROXY contains localhost

[✓] Connected device (3 available)
    • iPad Pro (11-inch) (3rd generation) (mobile) • 9D89D4DD-4B46-4A6F-999D-BABBB2808A98 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-14-5 (simulator)
    • macOS (desktop)                              • macos                                • darwin-x64     • macOS 11.5.2 20G95 darwin-x64
    • Chrome (web)                                 • chrome                               • web-javascript • Google Chrome 93.0.4577.82

• No issues found!
```

</details>

<details>
  <summary>Example</summary>

```dart
class _Content extends StatefulWidget {
  @override
  __ContentState createState() => __ContentState();
}

class __ContentState extends State<_Content> {
  final _controller = TextEditingController(text: '1');

  @override
  void dispose() {
    _controller.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('TextField设置了KeyboardType，在频繁切换键盘，文本内容消失'),
      ),
      body: ListView(
        padding: const EdgeInsets.all(10),
        children: [
          TextField(
            controller: _controller,
            decoration: InputDecoration(
              fillColor: Colors.white,
              filled: true,
              hintText: '请输入',
              contentPadding: const EdgeInsets.symmetric(
                horizontal: 15,
                vertical: 10,
              ),
              border: OutlineInputBorder(
                borderSide: BorderSide(
                  color: Theme.of(context).dividerColor,
                  width: 0,
                ),
              ),
            ),
            keyboardType: TextInputType.number,
          ),
        ],
      ),
    );
  }
}
```
</details>