fix material selection handle paint with transparent textSelectionHandleColor (#49830)
This commit is contained in:
parent
b2a27c109c
commit
275ec45ec4
@ -120,8 +120,10 @@ class _TextSelectionHandlePainter extends CustomPainter {
|
|||||||
void paint(Canvas canvas, Size size) {
|
void paint(Canvas canvas, Size size) {
|
||||||
final Paint paint = Paint()..color = color;
|
final Paint paint = Paint()..color = color;
|
||||||
final double radius = size.width/2.0;
|
final double radius = size.width/2.0;
|
||||||
canvas.drawCircle(Offset(radius, radius), radius, paint);
|
final Rect circle = Rect.fromCircle(center: Offset(radius, radius), radius: radius);
|
||||||
canvas.drawRect(Rect.fromLTWH(0.0, 0.0, radius, radius), paint);
|
final Rect point = Rect.fromLTWH(0.0, 0.0, radius, radius);
|
||||||
|
final Path path = Path()..addOval(circle)..addRect(point);
|
||||||
|
canvas.drawPath(path, paint);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -62,4 +62,39 @@ void main() {
|
|||||||
expect(materialTextSelectionControls.canSelectAll(key.currentState), false);
|
expect(materialTextSelectionControls.canSelectAll(key.currentState), false);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
group('material handles', () {
|
||||||
|
testWidgets('draws transparent handle correctly', (WidgetTester tester) async {
|
||||||
|
await tester.pumpWidget(RepaintBoundary(
|
||||||
|
child: Theme(
|
||||||
|
data: ThemeData(
|
||||||
|
textSelectionHandleColor: const Color(0x550000AA),
|
||||||
|
),
|
||||||
|
isMaterialAppTheme: true,
|
||||||
|
child: Builder(
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return Container(
|
||||||
|
color: Colors.white,
|
||||||
|
height: 800,
|
||||||
|
width: 800,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 250),
|
||||||
|
child: FittedBox(
|
||||||
|
child: materialTextSelectionControls.buildHandle(
|
||||||
|
context, TextSelectionHandleType.right, 10.0,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
));
|
||||||
|
|
||||||
|
await expectLater(
|
||||||
|
find.byType(RepaintBoundary),
|
||||||
|
matchesGoldenFile('transparent_handle.png'),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user