-
-
Notifications
You must be signed in to change notification settings - Fork 148
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
I/flutter (10005): 'package:flutter/src/services/text_editing.dart': Failed assertion: line 24 pos 15: 'start != null I/flutter (10005): && start >= -1': is not true. #16
Comments
can‘t reproduce。 |
and 4. platform |
android or ios? |
@zmtzawqlp both android and iOS |
@CSystem please replace code for insertText method void insertText(String text) {
var value = _textEditingController.value;
var start = value.selection.baseOffset;
var end = value.selection.extentOffset;
if (value.selection.isValid) {
String newText = "";
if (value.selection.isCollapsed) {
if (end > 0) {
newText += value.text.substring(0, end);
}
newText += text;
if (value.text.length > end) {
newText += value.text.substring(end, value.text.length);
}
} else {
newText = value.text.replaceRange(start, end, text);
end = start;
}
_textEditingController.value = value.copyWith(
text: newText,
selection: value.selection.copyWith(
baseOffset: end + text.length, extentOffset: end + text.length));
}
} please check whether error has fixed,thanks |
@zmtzawqlp If there is no focus, it will occurs the same error. |
@CSystem i think, you can take care of it by your case, this is just demo. take care of selection |
Sry,the error occurs at extended_text_field,not the extended_text.
flutter: Either the assertion indicates an error in the framework itself, or we should provide substantially
flutter: more information in this error message to help you determine and fix the underlying cause.
flutter: In either case, please report this assertion by filing a bug on GitHub:
flutter: https://github.com/flutter/flutter/issues/new?template=BUG.md
flutter:
flutter: When the exception was thrown, this was the stack:
flutter: #2 new TextRange
package:flutter/…/services/text_editing.dart:24
flutter: #3 new TextSelection
package:flutter/…/services/text_editing.dart:107
flutter: #4 ExtendedRenderEditable._getCaretOffset
package:extended_text_field/src/extended_render_editable.dart:1720
flutter: #5 ExtendedRenderEditable._updateSelectionExtentsVisibility
package:extended_text_field/src/extended_render_editable.dart:284
flutter: #6 ExtendedRenderEditable._paintContents
package:extended_text_field/src/extended_render_editable.dart:1886
flutter: #7 ExtendedRenderEditable.paint
package:extended_text_field/src/extended_render_editable.dart:1970
flutter: #8 RenderObject._paintWithContext
package:flutter/…/rendering/object.dart:2089
flutter: #9 PaintingContext.paintChild
package:flutter/…/rendering/object.dart:172
flutter: #10 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.paint
package:flutter/…/rendering/proxy_box.dart:123
flutter: #11 RenderObject._paintWithContext
package:flutter/…/rendering/object.dart:2089
flutter: #12 PaintingContext.paintChild
package:flutter/…/rendering/object.dart:172
flutter: #13 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.paint
package:flutter/…/rendering/proxy_box.dart:123
flutter: #14 PaintingContext.pushLayer
package:flutter/…/rendering/object.dart:369
flutter: #15 RenderLeaderLayer.paint
package:flutter/…/rendering/proxy_box.dart:4624
flutter: #16 RenderObject._paintWithContext
package:flutter/…/rendering/object.dart:2089
flutter: #17 PaintingContext.paintChild
package:flutter/…/rendering/object.dart:172
flutter: #18 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.paint
package:flutter/…/rendering/proxy_box.dart:123
flutter: #19 RenderObject._paintWithContext
package:flutter/…/rendering/object.dart:2089
flutter: #20 PaintingContext.paintChild
package:flutter/…/rendering/object.dart:172
flutter: #21 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.paint
package:flutter/…/rendering/proxy_box.dart:123
flutter: #22 RenderObject._paintWithContext
package:flutter/…/rendering/object.dart:2089
flutter: #23 PaintingContext.paintChild
package:flutter/…/rendering/object.dart:172
flutter: #24 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.paint
package:flutter/…/rendering/proxy_box.dart:123
flutter: #25 RenderPointerListener.paint
package:flutter/…/rendering/proxy_box.dart:2669
flutter: #26 RenderObject._paintWithContext
package:flutter/…/rendering/object.dart:2089
flutter: #27 PaintingContext.paintChild
package:flutter/…/rendering/object.dart:172
flutter: #28 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.paint
package:flutter/…/rendering/proxy_box.dart:123
flutter: #29 RenderPointerListener.paint
package:flutter/…/rendering/proxy_box.dart:2669
flutter: #30 RenderObject._paintWithContext
package:flutter/…/rendering/object.dart:2089
flutter: #31 PaintingContext.paintChild
package:flutter/…/rendering/object.dart:172
flutter: #32 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.paint
package:flutter/…/rendering/proxy_box.dart:123
flutter: #33 RenderObject._paintWithContext
package:flutter/…/rendering/object.dart:2089
flutter: #34 PaintingContext._repaintCompositedChild
package:flutter/…/rendering/object.dart:127
flutter: #35 PaintingContext.repaintCompositedChild
package:flutter/…/rendering/object.dart:95
flutter: #36 PipelineOwner.flushPaint
package:flutter/…/rendering/object.dart:858
flutter: #37 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding.drawFrame
package:flutter/…/rendering/binding.dart:348
flutter: #38 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding&WidgetsBinding.drawFrame
package:flutter/…/widgets/binding.dart:701
flutter: #39 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding._handlePersistentFrameCallback
package:flutter/…/rendering/binding.dart:285
flutter: #40 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._invokeFrameCallback
package:flutter/…/scheduler/binding.dart:1016
flutter: #41 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding.handleDrawFrame
package:flutter/…/scheduler/binding.dart:958
flutter: #42 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._handleDrawFrame
package:flutter/…/scheduler/binding.dart:874
flutter: #46 _invoke (dart:ui/hooks.dart:236:10)
flutter: #47 _drawFrame (dart:ui/hooks.dart:194:3)
flutter: (elided 5 frames from class _AssertionError and package dart:async)
flutter:
flutter: The following RenderObject was being processed when the exception was fired: ExtendedRenderEditable#7c4a8 relayoutBoundary=up16:
flutter: creator: _Editable-[GlobalKey#9d3c9] ← Semantics ← CompositedTransformTarget ←
flutter: IgnorePointer-[GlobalKey#2fe7b] ← Semantics ← Listener ←
flutter: RawGestureDetector-[LabeledGlobalKey#e3c22] ← Listener ← _ScrollableScope
flutter: ← Scrollable ← ExtendedEditableText-[LabeledGlobalKey#5f881] ←
flutter: RepaintBoundary ← ⋯
flutter: parentData: (can use size)
flutter: constraints: BoxConstraints(w=373.0, 0.0<=h<=Infinity)
flutter: size: Size(373.0, 19.0)
flutter: cursorColor: Color(0x002196f3)
flutter: showCursor: ValueNotifier#e75a2(false)
flutter: maxLines: 1
flutter: minLines: null
flutter: selectionColor: Color(0xff90caf9)
flutter: textScaleFactor: 1.0
flutter: locale: en_US
flutter: selection: TextSelection(baseOffset: -1, extentOffset: -1, affinity: TextAffinity.downstream,
flutter: isDirectional: false)
flutter: offset: ScrollPositionWithSingleContext#ce7dd(offset: 0.0, range: 0.0..0.0, viewport: 373.0,
flutter: ScrollableState, BouncingScrollPhysics, IdleScrollActivity#c0c2e, ScrollDirection.idle)
flutter: This RenderObject had the following descendants (showing up to depth 5):
flutter: text: TextSpan
flutter: ImageSpan#19251
flutter: ════════════════════════════════════════════════════════════════════════════════════════════════════
Step:
Just click the button in the demo,it will input a ImageSpan(Emoji) to the textfield, then the error will occurs.
Platform:
extended_text_field: ^0.4.1
extended_text: ^0.6.3
flutter:1.7.8+hotfixed4
os:Android or iOS
extended_textfield_demo.zip
The text was updated successfully, but these errors were encountered: