Repository: flutter
Issue: [Web] When the input field is restricted to only allow numbers, switching to the Chinese input method results in the entered numbers being gradually deleted, and it also allows exceeding the maximum input limit.
Labels: a: text input,framework,a: internationalization,platform-web,has reproducible steps,P2,team-web,triaged-web,found in release: 3.13,found in release: 3.17

### 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

flutter for web
1. Install Chinese input on a Windows computer.
2. Set the input to only support numbers and have a maximum length of 8 characters.
3. After completing the above steps, when entering a few numbers and switching to Chinese input mode, clicking in the input field causes the previously entered numbers to be gradually deleted, and it also allows exceeding the maximum input limit.

### Expected results

flutter for web
When restricting user input to numbers, switching the input method to Chinese should not affect the already entered content.
When the maximum limit is set, users should not be allowed to input more characters than the maximum limit.


### Actual results

flutter for web
First, I created an input field that restricts users to enter only numbers and has a maximum length of 8 characters.
    When I switch the input to Chinese, I observed that although Chinese characters cannot be entered, the existing numbers in the input field are being deleted by entering a letter. Why is this happening?
    There is another issue: even though I have set the maximum length to 8 characters, it is still exceeding the limit.


### Code sample

<details><summary>Code sample</summary>

```dart
 class CustomTextField extends StatelessWidget {
  final double width;
  final double height;
  final bool allowDecimal;
  final TextEditingController controller;
  final Function(String)? onSubmitted; // 用于处理回车事件

  CustomTextField({this.width = 50, this.height = 30, this.allowDecimal = false,required this.controller,this.onSubmitted});

  @override
  Widget build(BuildContext context) {
    List<TextInputFormatter> inputFormatters = [];
    if (allowDecimal) {
      inputFormatters = [FilteringTextInputFormatter.allow(RegExp(r'^\d+\.?\d{0,2}'))];
    } else {
      inputFormatters = [FilteringTextInputFormatter.digitsOnly];
    }

    return Container(
      width: width,
      height: height,
      alignment: Alignment.center,
      child: TextField(
        controller: controller,
        inputFormatters: inputFormatters,
        style: const TextStyle(fontSize: 12.0), // 设置文字大小
        cursorWidth: 1.5, // 设置光标宽度
        maxLength: 8,
        textAlign: TextAlign.center,
        decoration: InputDecoration(
          contentPadding: const EdgeInsets.symmetric(horizontal: 2),
          border: OutlineInputBorder(
            borderRadius: BorderRadius.circular(5.0),
          ),
        ),
        onSubmitted: onSubmitted,
      ),
    );
  }
}


CustomTextField(
          width: 300,
          height: 80,
          allowDecimal: true,
          controller: TextEditingController(),
        )
```

</details>


### Screenshots or Video

<details>
<summary>Screenshots / Video demonstration</summary>
 
https://github.com/flutter/flutter/assets/31436497/ab565264-a2b0-4743-b00e-3ede36cfe5ec


</details>


### Logs

<details><summary>Logs</summary>

```console
[Paste your logs here]
```

</details>


### Flutter Doctor output

<details><summary>Doctor output</summary>

```console
No Log.
```


</details>