Repository: flutter
Issue: Keyboard TextInputAction intermittently not changing when moving focus between fields
Labels: a: text input,platform-android,has reproducible steps,P2,team-text-input,triaged-text-input,found in release: 3.24,found in release: 3.27

### Steps to reproduce

1. Create two `TextField` widgets, the first with `TextInputAction.next`, the second with `TextInputAction.done`
2. Run the flutter app
3. Tap the first text field to focus it and bring up the android keyboard
4. Tap the "Next" button on the android keyboard to focus the second field

Tested on:
- Samsung S21 Ultra, Android 14
- Samsung Keyboard 5.8.20.7
- Flutter master 3.27.0-1.0.pre.660, and stable 3.24.4. Logs are from using Flutter master channel
- Affects both debug and release builds

### Expected results

The keyboard should display the "Done" keyboard action when the second field has been focussed after tapping the "Next" keyboard button on the first field. 

### Actual results

About 60% of the time, the keyboard continues to display the "Next" action on the second field after tapping the "Next" keyboard button on the first field. When tapping "Next" on the second field, the correct button "Done" displays briefly while the keyboard is being dismissed. 
I've included videos both of the issue occurring, and the roughly 40% of occasions when the issue does not occur and the code sample works as expected. 

### Code sample

<details open><summary>Code sample</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 const MaterialApp(
      title: 'Flutter Demo',
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatelessWidget {
  const MyHomePage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Input action not changing'),
      ),
      body: const Padding(
        padding: EdgeInsets.all(24),
        child: Column(
          mainAxisAlignment: MainAxisAlignment.start,
          children: <Widget>[
            TextField(
              decoration: InputDecoration(
                hintText: 'Field with next action',
              ),
              textInputAction: TextInputAction.next,
            ),
            TextField(
              decoration: InputDecoration(
                hintText: 'Field with done action',
              ),
              textInputAction: TextInputAction.done,
            ),
          ],
        ),
      ),
    );
  }
}

```

</details>


### Screenshots or Video

<details open>
<summary>Screenshots / Video demonstration</summary>

Issue occurring (~60% of the time):

https://github.com/user-attachments/assets/aad4ec4d-4412-4d39-8dec-f7907e1f7810

Working as expected (~40% of the time): 

https://github.com/user-attachments/assets/42087cee-9efb-4e6d-9ab6-fb365b0a0ee9

</details>


### Logs

<details open><summary>Logs</summary>

[logs.txt](https://github.com/user-attachments/files/17942008/logs.txt)


</details>


### Flutter Doctor output

<details open><summary>Doctor output</summary>

```console
[√] Flutter (Channel master, 3.27.0-1.0.pre.660, on Microsoft Windows [Version 10.0.22631.4460], locale en-AU)
    • Flutter version 3.27.0-1.0.pre.660 on channel master at C:\Users\t\fvm\versions\master
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision fdc666158e (8 hours ago), 2024-11-27 13:48:41 -0500
    • Engine revision ba112add5d
    • Dart version 3.7.0 (build 3.7.0-188.0.dev)
    • DevTools version 2.41.0-dev.2

[√] Windows Version (11 Pro 64-bit, 23H2, 2009)

[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at C:\Users\t\AppData\Local\Android\sdk
    • Platform android-35, build-tools 34.0.0
    • Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
      This is the JDK bundled with the latest Android Studio installation on this machine.
      To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
    • Java version OpenJDK Runtime Environment (build 21.0.3+-12282718-b509.11)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.6.2)
    • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
    • Visual Studio Community 2022 version 17.6.33723.286
    • Windows 10 SDK version 10.0.22000.0

[√] Android Studio (version 2024.2)
    • Android Studio at C:\Program Files\Android\Android Studio
    • 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 21.0.3+-12282718-b509.11)

[√] IntelliJ IDEA Community Edition (version 2021.2)
    • IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2021.2.2
    • 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

[√] VS Code (version 1.95.3)
    • VS Code at C:\Users\t\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.100.0

[√] Connected device (4 available)
    • SM G998B (mobile) • R5CR20A5RRA • android-arm64  • Android 14 (API 34)
    • Windows (desktop) • windows     • windows-x64    • Microsoft Windows [Version 10.0.22631.4460]
    • Chrome (web)      • chrome      • web-javascript • Google Chrome 131.0.6778.86
    • Edge (web)        • edge        • web-javascript • Microsoft Edge 131.0.2903.51

[√] Network resources
    • All expected network resources are available.
```

</details>