Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: writeText action only writing one character on iOS and Android #387

Open
k-ane opened this issue Jan 7, 2024 · 2 comments
Open

fix: writeText action only writing one character on iOS and Android #387

k-ane opened this issue Jan 7, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@k-ane
Copy link

k-ane commented Jan 7, 2024

I've only tested on iOS and Android simulator, but in both cases write text would only write one character, this was using the example provided by Fluttium as well.

The way I was able to work around this for now was to duplicate the action and write the whole text in one go instead of letter by letter, but a better solution should be found.

@override
  Future<bool> execute(Tester tester) async {
    TextInput.setInputControl(_textInputController);
    tester.emitPlatformMessage(
      SystemChannels.textInput.name,
      SystemChannels.textInput.codec.encodeMethodCall(
        const MethodCall('TextInputClient.requestExistingInputState'),
      ),
    );
    TextInput.restorePlatformInputControl();

    // Temporary workaround, enter whole text instead of character by character
    await _enterText(tester, text);
    await tester.pumpAndSettle();

    // for (final char in text.split('')) {
    //   await _enterText(tester, char);
    //   await tester.pumpAndSettle();
    // }
    return true;
  }
@k-ane k-ane added the bug Something isn't working label Jan 7, 2024
@Dustec
Copy link

Dustec commented Apr 2, 2024

Can you share the full code if this work around?

@mskhan18
Copy link

@k-ane were you able to fix this issue? Because I also have this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants