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

TextEdit input error - SpannableStringBuilder, SPAN_EXCLUSIVE_EXCLUSIVE #33255

Closed
charlesokt opened this issue May 23, 2019 · 3 comments
Closed
Labels
f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels.

Comments

@charlesokt
Copy link

charlesokt commented May 23, 2019

Steps to Reproduce

  1. Using Samsung Galaxy Tablet 8 A (Android 8.1), navigate to screen (code below)
  2. Touch TextEdit widget
  3. Keyboard pops up as expected
  4. Type 'abc'
  5. Hit done on soft keyboard
  6. Touch TextEdit widget again to edit text
  7. Type 'd'
  8. TextEdit widget now shows 'abcabcd'

Code

import 'package:flutter/material.dart';

class PlaygroundScreen extends StatefulWidget {

  PlaygroundScreen({Key key,
  }) : super(key: key);

  @override
  _PlaygroundState createState() => _PlaygroundState();

}

class _PlaygroundState extends State<PlaygroundScreen> {

  final TextEditingController _tfController = new TextEditingController();

  @override
  initState() {
    super.initState();

    _tfController.addListener(_tfTestListen);
  }

  void _tfTestListen() {
    print('new text -> ${_tfController.text}');
  }

  @override
  Widget build(BuildContext context) {

    TextField tfTest = TextField(
      controller: _tfController,
      decoration: InputDecoration(
          labelText: 'Test me'
      ),
    );

    Center center = Center(
      child: tfTest,
    );

    Column col = Column(
      children: <Widget>[
        Expanded(child: center)
      ],
    );

    Scaffold scaffold = Scaffold(
        appBar: AppBar(title: Text('Playground'), backgroundColor: Colors.red),
        body: col
    );

    return scaffold;
  }

}

Logs

I/flutter (10968): new text -> abc
D/ViewRootImpl@57c8b53[MainActivity](10968): MSG_RESIZED: frame=Rect(0, 0 - 800, 1280) ci=Rect(0, 32 - 0, 494) vi=Rect(0, 32 - 0, 494) or=1
D/ViewRootImpl@57c8b53[MainActivity](10968): Relayout returned: old=[0,0][800,1280] new=[0,0][800,1280] result=0x1 surface={valid=true 2305288192} changed=false
E/SpannableStringBuilder(10968): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
E/SpannableStringBuilder(10968): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
I/flutter (10968): new text -> abcabcd

Flutter Doctor

[√] Flutter (Channel unknown, v1.5.4-hotfix.2, on Microsoft Windows [Version 10.0.17763.475], locale en-US)
    • Flutter version 1.5.4-hotfix.2 at C:\dev\fluttersdk\flutter
    • Framework revision 7a4c33425d (3 weeks ago), 2019-04-29 11:05:24 -0700
    • Engine revision 52c7a1e849
    • Dart version 2.3.0 (build 2.3.0-dev.0.5 a1668566e5)

[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at C:\Users\ko\AppData\Local\Android\sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.3
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
    • All Android licenses accepted.

[√] Android Studio (version 3.4)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin version 35.3.1
    • Dart plugin version 183.6270
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)

[√] Connected device (2 available)
    • SM T380                   • 83a74311b5805db4 • android-arm • Android 8.1.0 (API 27)
    • Android SDK built for x86 • emulator-5554    • android-x86 • Android 6.0 (API 23) (emulator)

• No issues found!

Possibly related: #10363

@charlesokt
Copy link
Author

I should mention that turning OFF predictive text in the stock keyboard on the device apparently side steps the issue at hand. Not sure if this is helpful.

@charlesokt charlesokt changed the title TextEdit input error - SpannableStringBuilder, SPAN_EXCLUSIVE_EXCLUSIVE, TextEdit input error - SpannableStringBuilder, SPAN_EXCLUSIVE_EXCLUSIVE May 23, 2019
@darrenaustin darrenaustin added f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels. labels May 23, 2019
@justinmc
Copy link
Contributor

This looks to be the same as #31512.

I'm going to close this issue and paste some info from your issue over there, and we can track progress there. Let me know if you actually think this is a separate issue or something and we can reopen it.

@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 29, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels.
Projects
None yet
Development

No branches or pull requests

3 participants