Skip to content

TextInputConnection updateConfig does not update action button #97253

Open

Description

@matthew-carroll

Software keyboards have an "action button". It often shows a message like "Done", "Search", or shows a newline icon. This button can be configured as needed by an app. Flutter provides an API to configure this button when the keyboard first opens, as well as an API to change the button after the keyboard is already open.

Flutter's API to change the button after the keyboard has opened doesn't work.

Here's a Flutter snippet that provides an initial keyboard configuration and shows the keyboard:

_inputConnection = TextInput.attach(
  this, // or whatever you have that implements TextInputClient
  TextInputConfiguration(
    enableDeltaModel: true,
    inputAction: TextInputAction.newline,
    // possibly other configurations
  ),
);

_inputConnection!
  ..show()
  ..setEditingState(/* pass in some initial editing value */);

Once the keyboard is visible, an app should be able to change the action button using the following code, but the button doesn't change:

_inputConnection.updateConfig(
  TextInputConfiguration(
    enableDeltaModel: true,
    inputAction: TextInputAction.done,
    // possibly other configurations
  ),
);

Expected result: When the 2nd snippet executes, the keyboard changes its action button from a newline icon to a "Done" button.

Actual result: When the 2nd snippet executes, the action button doesn't change.

I've reproduced this issue on:

  • iOS simulator (iOS 15.0)
  • iPhone 7 (iOS 13.6.1)
  • Android emulator (Android 10 - AKA API 29)
  • Pixel 4a (Android 12)

Flutter version:

Flutter 2.8.0 • channel stable • https://github.com/flutter/flutter.git
Framework • revision cf44000065 (7 weeks ago) • 2021-12-08 14:06:50 -0800
Engine • revision 40a99c5951
Tools • Dart 2.15.0

Activity

  1. added
    in triage
    on Jan 26, 2022
  2. maheshj01 commented on Jan 26, 2022

    @maheshj01
    Member

    Hi @matthew-carroll, Thanks for filing the issue. Can you please share a minimal and complete reproducible code sample that shows this behavior?

    Thanks

  3. added
    waiting for response
    on Jan 26, 2022
  4. justinmc commented on Jan 26, 2022

    @justinmc
    Contributor

    I tried to reproduce this quickly using EditableText and it didn't show the keyboard. I think I need to create my own fake TextInputClient implementer to get it to work?

    Code
    import 'package:flutter/material.dart';
    import 'package:flutter/services.dart';
    
    void main() => runApp(MyApp());
    
    class MyApp extends StatelessWidget {
      MyApp({
        Key? key,
      }) : super(key: key);
    
      final GlobalKey _key = GlobalKey();
      final FocusNode _focusNode = FocusNode();
      final TextEditingController _controller = TextEditingController();
      late final TextInputConnection _inputConnection;
    
      @override
      Widget build(BuildContext context) {
        return MaterialApp(
          title: 'Flutter Demo',
          theme: ThemeData(
            primarySwatch: Colors.blue,
          ),
          home: Scaffold(
            appBar: AppBar(
              title: const Text('Flutter Demo'),
            ),
            body: Center(
              child: Column(
                children: <Widget>[
                  EditableText(
                    key: _key,
                    backgroundCursorColor: Colors.grey,
                    controller: _controller,
                    focusNode: _focusNode,
                    style: const TextStyle(),
                    cursorColor: Colors.blue,
                  ),
                  TextButton(
                    onPressed: () {
                      final EditableTextState editableTextState = _key.currentState as EditableTextState;
                      _inputConnection = TextInput.attach(
                        editableTextState,
                        const TextInputConfiguration(
                          enableDeltaModel: true,
                          inputAction: TextInputAction.newline,
                        ),
                      );
    
                      _inputConnection
                        ..show()
                        ..setEditingState(const TextEditingValue(
                          text: 'Initialized!',
                        ));
                    },
                    child: const Text('press me'),
                  ),
                  TextButton(
                    onPressed: () {
                      _inputConnection.updateConfig(
                        const TextInputConfiguration(
                          enableDeltaModel: true,
                          inputAction: TextInputAction.done,
                          // possibly other configurations
                        ),
                      );
                    },
                    child: const Text('then press me'),
                  ),
                ],
              ),
            ),
          ),
        );
      }
    }
  5. matthew-carroll commented on Jan 27, 2022

    @matthew-carroll
    ContributorAuthor

    @justinmc are you using an iOS simulator? If so, did you try saying "Toggle Software Keyboard" from the simulator app menu? There can be some inconsistencies there.

    If you ran on a physical device and it didn't open, then I'm not sure. It might depend on what that State object is doing that you passed in. In the case of super_editor, we have to implement that interface, so we pass in our own implementation.

  6. removed
    waiting for response
    on Jan 27, 2022
  7. maheshj01 commented on Jan 27, 2022

    @maheshj01
    Member

    Thanks for the code sample @justinmc, I can reproduce this issue on stable and the master channel on calling updateConfig I don't see any of the input control configuration getting updated neither on Android nor on IOS.

    Android IOS
    Screen.Recording.2022-01-27.at.12.25.42.PM.mov
    Screen.Recording.2022-01-27.at.12.13.58.PM.mov

    Note: if the keyboard doesn't show up on IOS simulator then try pressing command + k

    flutter doctor -v
    [✓] Flutter (Channel master, 2.10.0-1.0.pre.307, on macOS 12.1 21C52 darwin-arm, locale en-GB)
        • Flutter version 2.10.0-1.0.pre.307 at /Users/mahesh/Documents/flutter_master
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision b7424c619c (6 hours ago), 2022-01-26 17:25:45 -0800
        • Engine revision c248c6e38e
        • Dart version 2.17.0 (build 2.17.0-63.0.dev)
        • DevTools version 2.10.0-dev.1
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
        • Android SDK at /Users/mahesh/Library/Android/sdk
        • Platform android-31, build-tools 31.0.0
        • ANDROID_HOME = /Users/mahesh/Library/Android/sdk
        • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
        • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)
        • All Android licenses accepted.
    
    [✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • CocoaPods version 1.10.2
    
    [✓] Chrome - develop for the web
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] Android Studio (version 4.2)
        • 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.8+10-b944.6916264)
    
    [✓] IntelliJ IDEA Community Edition (version 2021.2.1)
        • IntelliJ at /Applications/IntelliJ IDEA CE.app
        • Flutter plugin version 60.1.4
        • Dart plugin version 212.5080.8
    
    [✓] VS Code (version 1.63.2)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.32.0
    
    [✓] Connected device (4 available)
        • Redmi K20 Pro (mobile) • d9dac45d                             • android-arm64  • Android 11 (API 30)
        • iPhone 12 Pro (mobile) • 14F40EC6-3B73-469A-A1C0-8CF0B152290F • ios            •
          com.apple.CoreSimulator.SimRuntime.iOS-14-5 (simulator)
        • macOS (desktop)        • macos                                • darwin-arm64   • macOS 12.1 21C52 darwin-arm
        • Chrome (web)           • chrome                               • web-javascript • Google Chrome 97.0.4692.99
    
    [✓] HTTP Host Availability
        • All required HTTP hosts are available
    
    • No issues found!
    
    [✓] Flutter (Channel stable, 2.8.1, on macOS 12.1 21C52 darwin-arm, locale en-GB)
        • Flutter version 2.8.1 at /Users/mahesh/Documents/flutter
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision 77d935af4d (6 weeks ago), 2021-12-16 08:37:33 -0800
        • Engine revision 890a5fca2e
        • Dart version 2.15.1
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
        • Android SDK at /Users/mahesh/Library/Android/sdk
        • Platform android-31, build-tools 31.0.0
        • ANDROID_HOME = /Users/mahesh/Library/Android/sdk
        • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
        • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)
        • All Android licenses accepted.
    
    [✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • CocoaPods version 1.10.2
    
    [✓] Chrome - develop for the web
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] Android Studio (version 4.2)
        • 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.8+10-b944.6916264)
    
    [✓] IntelliJ IDEA Community Edition (version 2021.2.1)
        • IntelliJ at /Applications/IntelliJ IDEA CE.app
        • Flutter plugin version 60.1.4
        • Dart plugin version 212.5080.8
    
    [✓] VS Code (version 1.63.2)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.32.0
    
    [✓] Connected device (4 available)
        • Redmi K20 Pro (mobile) • d9dac45d                             • android-arm64  • Android 11 (API 30)
        • iPhone 12 Pro (mobile) • 14F40EC6-3B73-469A-A1C0-8CF0B152290F • ios            •
          com.apple.CoreSimulator.SimRuntime.iOS-14-5 (simulator)
        • macOS (desktop)        • macos                                • darwin-arm64   • macOS 12.1 21C52 darwin-arm
        • Chrome (web)           • chrome                               • web-javascript • Google Chrome 97.0.4692.99
    
    • No issues found!
    
    code sample
    import 'package:flutter/material.dart';
    import 'package:flutter/services.dart';
    
    void main() => runApp(MyApp());
    
    class MyApp extends StatelessWidget {
      MyApp({
        Key? key,
      }) : super(key: key);
    
      final GlobalKey _key = GlobalKey();
      final FocusNode _focusNode = FocusNode();
      final TextEditingController _controller = TextEditingController();
      TextInputConnection? _inputConnection;
    
      @override
      Widget build(BuildContext context) {
        return MaterialApp(
          title: 'Flutter Demo',
          theme: ThemeData(
            primarySwatch: Colors.blue,
          ),
          home: Scaffold(
            appBar: AppBar(
              title: const Text('Flutter Demo'),
            ),
            body: Center(
              child: Column(
                children: <Widget>[
                  EditableText(
                    key: _key,
                    backgroundCursorColor: Colors.grey,
                    controller: _controller,
                    focusNode: _focusNode,
                    style: const TextStyle(),
                    cursorColor: Colors.blue,
                  ),
                  TextButton(
                    onPressed: () {
                      final EditableTextState editableTextState =
                          _key.currentState as EditableTextState;
                      // if (!_inputConnection!.attached) {
                      _inputConnection = TextInput.attach(
                        editableTextState,
                        const TextInputConfiguration(
                          enableDeltaModel: true,
                          keyboardAppearance: Brightness.dark,
                          inputAction: TextInputAction.newline,
                        ),
                      );
                      // }
    
                      _inputConnection!
                        ..show()
                        ..setEditingState(const TextEditingValue(
                          text: 'Initialized!',
                        ));
                    },
                    child: const Text('show input control'),
                  ),
                  TextButton(
                    onPressed: () {
                      _inputConnection!.updateConfig(
                        const TextInputConfiguration(
                          // inputType: TextInputType.number,
                          // keyboardAppearance: Brightness.light,
                          enableDeltaModel: true,
                          inputAction: TextInputAction.done,
                          // possibly other configurations
                        ),
                      );
                    },
                    child: const Text('update config'),
                  ),
                  TextButton(
                      onPressed: () {
                        _inputConnection!.close();
                      },
                      child: const Text('close input control'))
                ],
              ),
            ),
          ),
        );
      }
    }
    
  8. added
    a: text input
    found in release: 2.8
    found in release: 2.10
    framework
    has reproducible steps
    and removed
    in triage
    on Jan 27, 2022
  9. added
    P2
    on Feb 2, 2022
  10. added
    team-framework
    triaged-framework
    on Jul 8, 2023
  11. tirth-patel-nc commented on May 13, 2025

    @tirth-patel-nc
    Member

    Triage Report

    I was able to reproduce the issue using the provided code sample on both the stable (3.29.3) and master (3.32.0-1.0.pre.514) channels.

    Android iOS
    screen-20250513-162559.mp4
    Simulator.Screen.Recording.-.iPhone.16.Plus.-.2025-05-13.at.16.25.06.mp4
    Code Sample
    import 'package:flutter/material.dart';
    import 'package:flutter/services.dart';
    
    void main() => runApp(MyApp());
    
    class MyApp extends StatefulWidget {
      const MyApp({super.key});
    
      @override
      State<MyApp> createState() => _MyAppState();
    }
    
    class _MyAppState extends State<MyApp> {
      final GlobalKey _key = GlobalKey();
    
      final FocusNode _focusNode = FocusNode();
    
      final TextEditingController _controller = TextEditingController();
    
      TextInputConnection? _inputConnection;
    
      @override
      Widget build(BuildContext context) {
        return MaterialApp(
          title: 'Flutter Demo',
          theme: ThemeData(primarySwatch: Colors.blue),
          home: Scaffold(
            appBar: AppBar(title: const Text('Flutter Demo')),
            body: Center(
              child: Column(
                children: <Widget>[
                  EditableText(
                    key: _key,
                    backgroundCursorColor: Colors.grey,
                    controller: _controller,
                    focusNode: _focusNode,
                    style: const TextStyle(),
                    cursorColor: Colors.blue,
                  ),
                  TextButton(
                    onPressed: () {
                      final EditableTextState editableTextState =
                          _key.currentState as EditableTextState;
                      // if (!_inputConnection!.attached) {
                      _inputConnection = TextInput.attach(
                        editableTextState,
                        const TextInputConfiguration(
                          enableDeltaModel: true,
                          keyboardAppearance: Brightness.dark,
                          inputAction: TextInputAction.newline,
                        ),
                      );
                      // }
    
                      _inputConnection!
                        ..show()
                        ..setEditingState(
                          const TextEditingValue(text: 'Initialized!'),
                        );
                    },
                    child: const Text('show input control'),
                  ),
                  TextButton(
                    onPressed: () {
                      _inputConnection!.updateConfig(
                        const TextInputConfiguration(
                          // inputType: TextInputType.number,
                          // keyboardAppearance: Brightness.light,
                          enableDeltaModel: true,
                          inputAction: TextInputAction.done,
                          // possibly other configurations
                        ),
                      );
                    },
                    child: const Text('update config'),
                  ),
                  TextButton(
                    onPressed: () {
                      _inputConnection!.close();
                    },
                    child: const Text('close input control'),
                  ),
                ],
              ),
            ),
          ),
        );
      }
    }
    stable (3.29.3) - flutter doctor -v
    [✓] Flutter (Channel stable, 3.29.3, on macOS 15.4.1 24E263 darwin-arm64, locale
        en-IN) [970ms]
        • Flutter version 3.29.3 on channel stable at
          /Users/tirthpatel/Development/flutter_stable/flutter
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision ea121f8859 (4 weeks ago), 2025-04-11 19:10:07 +0000
        • Engine revision cf56914b32
        • Dart version 3.7.2
        • DevTools version 2.42.3
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 36.0.0)
        [855ms]
        • Android SDK at /Users/tirthpatel/Library/Android/sdk
        • Platform android-36, build-tools 36.0.0
        • Java binary at: /Applications/Android
          Studio.app/Contents/jbr/Contents/Home/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.6+-13355223-b631.42)
        • All Android licenses accepted.
    
    [✓] Xcode - develop for iOS and macOS (Xcode 16.3) [556ms]
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • Build 16E140
        • CocoaPods version 1.16.2
    
    [✓] Chrome - develop for the web [9ms]
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] Android Studio (version 2024.3) [9ms]
        • 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 21.0.6+-13355223-b631.42)
    
    [✓] VS Code (version 1.99.3) [8ms]
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension can be installed from:
          🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
    
    [✓] Connected device (3 available) [5.5s]
        • macOS (desktop)                 • macos                 • darwin-arm64   •
          macOS 15.4.1 24E263 darwin-arm64
        • Mac Designed for iPad (desktop) • mac-designed-for-ipad • darwin         •
          macOS 15.4.1 24E263 darwin-arm64
        • Chrome (web)                    • chrome                • web-javascript •
          Google Chrome 135.0.7049.115
    
    [✓] Network resources [559ms]
        • All expected network resources are available.
    
    • No issues found!
    
    master (3.32.0-1.0.pre.514) - flutter doctor -v
    [✓] Flutter (Channel master, 3.32.0-1.0.pre.514, on macOS 15.4.1 24E263 darwin-arm64, locale en-IN) [1,266ms]
        • Flutter version 3.32.0-1.0.pre.514 on channel master at /Users/tirthpatel/Development/flutter_master/flutter
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision 149ac49583 (3 hours ago), 2025-05-12 22:41:39 -0400
        • Engine revision 149ac49583
        • Dart version 3.9.0 (build 3.9.0-114.0.dev)
        • DevTools version 2.46.0
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 36.0.0) [784ms]
        • Android SDK at /Users/tirthpatel/Library/Android/sdk
        • Emulator version 35.4.9.0 (build_id 13025442) (CL:N/A)
        • Platform android-36, build-tools 36.0.0
        • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/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.6+-13355223-b631.42)
        • All Android licenses accepted.
    
    [✓] Xcode - develop for iOS and macOS (Xcode 16.3) [434ms]
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • Build 16E140
        • CocoaPods version 1.16.2
    
    [✓] Chrome - develop for the web [7ms]
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] Android Studio (version 2024.3) [7ms]
        • 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 21.0.6+-13355223-b631.42)
    
    [✓] VS Code (version 1.100.0) [6ms]
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.110.0
    
    [✓] Connected device (2 available) [5.6s]
        • macOS (desktop) • macos  • darwin-arm64   • macOS 15.4.1 24E263 darwin-arm64
        • Chrome (web)    • chrome • web-javascript • Google Chrome 136.0.7103.93
    
    [✓] Network resources [553ms]
        • All expected network resources are available.
    
    • No issues found!
    
  12. added
    found in release: 3.29
    found in release: 3.32
    and removed
    found in release: 2.8
    found in release: 2.10
    on May 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2a: text inputfound in release: 3.29found in release: 3.32frameworkhas reproducible stepsteam-frameworktriaged-framework

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions