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
9e9e7416
Unverified
Commit
9e9e7416
authored
Feb 03, 2020
by
Bogdan Lukin
Committed by
GitHub
Feb 03, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix cupertino selection handle paint with transparent color (#49910)
parent
b24bca13
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
15 deletions
+49
-15
text_selection.dart
packages/flutter/lib/src/cupertino/text_selection.dart
+13
-15
text_selection_test.dart
packages/flutter/test/cupertino/text_selection_test.dart
+36
-0
No files found.
packages/flutter/lib/src/cupertino/text_selection.dart
View file @
9e9e7416
...
...
@@ -260,26 +260,24 @@ class _TextSelectionHandlePainter extends CustomPainter {
@override
void
paint
(
Canvas
canvas
,
Size
size
)
{
final
Paint
paint
=
Paint
()
..
color
=
color
..
strokeWidth
=
2.0
;
canvas
.
drawCircle
(
const
Offset
(
_kSelectionHandleRadius
,
_kSelectionHandleRadius
),
_kSelectionHandleRadius
,
paint
,
const
double
halfStrokeWidth
=
1.0
;
final
Paint
paint
=
Paint
()..
color
=
color
;
final
Rect
circle
=
Rect
.
fromCircle
(
center:
const
Offset
(
_kSelectionHandleRadius
,
_kSelectionHandleRadius
),
radius:
_kSelectionHandleRadius
,
);
// Draw line so it slightly overlaps the circle.
canvas
.
drawLine
(
final
Rect
line
=
Rect
.
fromPoints
(
const
Offset
(
_kSelectionHandleRadius
,
_kSelectionHandleRadius
-
halfStrokeWidth
,
2
*
_kSelectionHandleRadius
-
_kSelectionHandleOverlap
,
),
Offset
(
_kSelectionHandleRadius
,
size
.
height
,
),
paint
,
Offset
(
_kSelectionHandleRadius
+
halfStrokeWidth
,
size
.
height
),
);
final
Path
path
=
Path
()
..
addOval
(
circle
)
// Draw line so it slightly overlaps the circle.
..
addRect
(
line
);
canvas
.
drawPath
(
path
,
paint
);
}
@override
...
...
packages/flutter/test/cupertino/text_selection_test.dart
View file @
9e9e7416
...
...
@@ -62,4 +62,40 @@ void main() {
expect
(
cupertinoTextSelectionControls
.
canSelectAll
(
key
.
currentState
),
false
);
});
});
group
(
'cupertino handles'
,
()
{
testWidgets
(
'draws transparent handle correctly'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
RepaintBoundary
(
child:
CupertinoTheme
(
data:
const
CupertinoThemeData
(
primaryColor:
Color
(
0x550000AA
),
),
child:
Builder
(
builder:
(
BuildContext
context
)
{
return
Container
(
color:
CupertinoColors
.
white
,
height:
800
,
width:
800
,
child:
Padding
(
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
250
),
child:
FittedBox
(
child:
cupertinoTextSelectionControls
.
buildHandle
(
context
,
TextSelectionHandleType
.
right
,
10.0
,
),
),
),
);
},
),
),
));
await
expectLater
(
find
.
byType
(
RepaintBoundary
),
matchesGoldenFile
(
'text_selection.handle.transparent.png'
),
);
});
});
}
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