Remove an assert with false positives (#148795)
Fixes https://github.com/flutter/flutter/issues/110343. This is not an important piece of guardrail and the iOS embedder only expects best-effort results anyways.
This commit is contained in:
@@ -4494,7 +4494,6 @@ class EditableTextState extends State<EditableText> with AutomaticKeepAliveClien
|
||||
Rect? composingRect = renderEditable.getRectForComposingRange(composingRange);
|
||||
// Send the caret location instead if there's no marked text yet.
|
||||
if (composingRect == null) {
|
||||
assert(!composingRange.isValid || composingRange.isCollapsed);
|
||||
final int offset = composingRange.isValid ? composingRange.start : 0;
|
||||
composingRect = renderEditable.getLocalRectForCaret(TextPosition(offset: offset));
|
||||
}
|
||||
|
||||
@@ -17548,6 +17548,37 @@ void main() {
|
||||
const TextSelection.collapsed(offset: 17, affinity: TextAffinity.upstream),
|
||||
);
|
||||
});
|
||||
|
||||
testWidgets('Composing region can truncate grapheme', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
MediaQuery(
|
||||
data: const MediaQueryData(),
|
||||
child: Directionality(
|
||||
textDirection: TextDirection.ltr,
|
||||
child: EditableText(
|
||||
autofocus: true,
|
||||
backgroundCursorColor: Colors.grey,
|
||||
controller: controller,
|
||||
focusNode: focusNode,
|
||||
style: textStyle,
|
||||
cursorColor: cursorColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
assert(focusNode.hasFocus);
|
||||
|
||||
controller.value = const TextEditingValue(
|
||||
text: 'Á',
|
||||
selection: TextSelection(baseOffset: 1, extentOffset: 2),
|
||||
composing: TextSelection(baseOffset: 1, extentOffset: 2),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(tester.takeException(), isNull);
|
||||
});
|
||||
}
|
||||
|
||||
class UnsettableController extends TextEditingController {
|
||||
|
||||
Reference in New Issue
Block a user