Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
90afc5e8
Unverified
Commit
90afc5e8
authored
May 30, 2023
by
Tomasz Gucio
Committed by
GitHub
May 30, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Take paint offset into account for Editable children (#127843)
parent
2f521a21
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
1 deletion
+40
-1
editable.dart
packages/flutter/lib/src/rendering/editable.dart
+1
-1
editable_test.dart
packages/flutter/test/rendering/editable_test.dart
+39
-0
No files found.
packages/flutter/lib/src/rendering/editable.dart
View file @
90afc5e8
...
...
@@ -2459,7 +2459,7 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin,
}
_textPainter
.
paint
(
context
.
canvas
,
effectiveOffset
);
paintInlineChildren
(
context
,
o
ffset
);
paintInlineChildren
(
context
,
effectiveO
ffset
);
if
(
foregroundChild
!=
null
)
{
context
.
paintChild
(
foregroundChild
,
offset
);
...
...
packages/flutter/test/rendering/editable_test.dart
View file @
90afc5e8
...
...
@@ -1558,6 +1558,45 @@ void main() {
expect
(
composingRect
,
null
);
},
skip:
isBrowser
);
// https://github.com/flutter/flutter/issues/61021
test
(
'WidgetSpan render box is painted at correct offset when scrolled'
,
()
async
{
final
TextSelectionDelegate
delegate
=
_FakeEditableTextState
()
..
textEditingValue
=
const
TextEditingValue
(
text:
'test'
,
selection:
TextSelection
.
collapsed
(
offset:
3
),
);
final
List
<
RenderBox
>
renderBoxes
=
<
RenderBox
>[
RenderParagraph
(
const
TextSpan
(
text:
'b'
),
textDirection:
TextDirection
.
ltr
),
];
final
ViewportOffset
viewportOffset
=
ViewportOffset
.
fixed
(
100.0
);
final
RenderEditable
editable
=
RenderEditable
(
backgroundCursorColor:
Colors
.
grey
,
selectionColor:
Colors
.
black
,
textDirection:
TextDirection
.
ltr
,
cursorColor:
Colors
.
red
,
offset:
viewportOffset
,
textSelectionDelegate:
delegate
,
startHandleLayerLink:
LayerLink
(),
endHandleLayerLink:
LayerLink
(),
maxLines:
null
,
text:
TextSpan
(
style:
const
TextStyle
(
height:
1.0
,
fontSize:
10.0
),
children:
<
InlineSpan
>[
const
TextSpan
(
text:
'test'
),
WidgetSpan
(
child:
Container
(
width:
10
,
height:
10
,
color:
Colors
.
blue
)),
],
),
selection:
const
TextSelection
.
collapsed
(
offset:
3
),
children:
renderBoxes
,
);
_applyParentData
(
renderBoxes
,
editable
.
text
!);
layout
(
editable
);
editable
.
hasFocus
=
true
;
pumpFrame
();
final
Rect
composingRect
=
editable
.
getRectForComposingRange
(
const
TextRange
(
start:
4
,
end:
5
))!;
expect
(
composingRect
,
const
Rect
.
fromLTRB
(
40.0
,
-
100.0
,
54.0
,
-
86.0
));
},
skip:
isBrowser
);
// https://github.com/flutter/flutter/issues/61021
test
(
'can compute IntrinsicWidth for WidgetSpans'
,
()
{
// Regression test for https://github.com/flutter/flutter/issues/59316
const
double
screenWidth
=
1000.0
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment