Skip to content

Commit 7bf237f

Browse files
authored
[fix]: The selection effect can't be seen as the textLine with background color (singerdmx#429)
1 parent 926afac commit 7bf237f

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

lib/src/widgets/text_line.dart

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -812,15 +812,6 @@ class RenderEditableTextLine extends RenderEditableBox {
812812
if (_body != null) {
813813
final parentData = _body!.parentData as BoxParentData;
814814
final effectiveOffset = offset + parentData.offset;
815-
if (enableInteractiveSelection &&
816-
line.documentOffset <= textSelection.end &&
817-
textSelection.start <= line.documentOffset + line.length - 1) {
818-
final local = localSelection(line, textSelection, false);
819-
_selectedRects ??= _body!.getBoxesForSelection(
820-
local,
821-
);
822-
_paintSelection(context, effectiveOffset);
823-
}
824815

825816
if (hasFocus &&
826817
cursorCont.show.value &&
@@ -837,6 +828,17 @@ class RenderEditableTextLine extends RenderEditableBox {
837828
cursorCont.style.paintAboveText) {
838829
_paintCursor(context, effectiveOffset, line.hasEmbed);
839830
}
831+
832+
// paint the selection on the top
833+
if (enableInteractiveSelection &&
834+
line.documentOffset <= textSelection.end &&
835+
textSelection.start <= line.documentOffset + line.length - 1) {
836+
final local = localSelection(line, textSelection, false);
837+
_selectedRects ??= _body!.getBoxesForSelection(
838+
local,
839+
);
840+
_paintSelection(context, effectiveOffset);
841+
}
840842
}
841843
}
842844

0 commit comments

Comments
 (0)