fix cupertino selection handle paint with transparent color  (#49910)

diff --git a/packages/flutter/lib/src/cupertino/text_selection.dart b/packages/flutter/lib/src/cupertino/text_selection.dart
index e322172..58835fc 100644
--- a/packages/flutter/lib/src/cupertino/text_selection.dart
+++ b/packages/flutter/lib/src/cupertino/text_selection.dart
@@ -260,26 +260,24 @@
 
   @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
diff --git a/packages/flutter/test/cupertino/text_selection_test.dart b/packages/flutter/test/cupertino/text_selection_test.dart
index 1fceb43..ae4183a 100644
--- a/packages/flutter/test/cupertino/text_selection_test.dart
+++ b/packages/flutter/test/cupertino/text_selection_test.dart
@@ -62,4 +62,40 @@
       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'),
+      );
+    });
+  });
 }