File tree Expand file tree Collapse file tree 2 files changed +33
-2
lines changed Expand file tree Collapse file tree 2 files changed +33
-2
lines changed Original file line number Diff line number Diff line change @@ -559,7 +559,6 @@ abstract class ToggleablePainter extends ChangeNotifier implements CustomPainter
559559 focusColor,
560560 reactionFocusFade.value,
561561 )! ;
562- final Offset center = Offset .lerp (downPosition ?? origin, origin, reaction.value)! ;
563562 final Animatable <double > radialReactionRadiusTween = Tween <double >(
564563 begin: 0.0 ,
565564 end: splashRadius,
@@ -568,7 +567,7 @@ abstract class ToggleablePainter extends ChangeNotifier implements CustomPainter
568567 ? splashRadius
569568 : radialReactionRadiusTween.evaluate (reaction);
570569 if (reactionRadius > 0.0 ) {
571- canvas.drawCircle (center + offset, reactionRadius, reactionPaint);
570+ canvas.drawCircle (origin + offset, reactionRadius, reactionPaint);
572571 }
573572 }
574573 }
Original file line number Diff line number Diff line change @@ -602,6 +602,38 @@ void main() {
602602 );
603603 });
604604
605+ testWidgets ('Checkbox starts the splash in center, even when tap is on the corner' , (WidgetTester tester) async {
606+ Widget buildApp () {
607+ return MaterialApp (
608+ theme: theme,
609+ home: Material (
610+ child: Center (
611+ child: StatefulBuilder (builder: (BuildContext context, StateSetter setState) {
612+ return Checkbox (
613+ value: false ,
614+ onChanged: (bool ? newValue) {},
615+ );
616+ }),
617+ ),
618+ ),
619+ );
620+ }
621+
622+ await tester.pumpWidget (buildApp ());
623+ final Offset checkboxTopLeftGlobal = tester.getTopLeft (find.byType (Checkbox ));
624+ final Offset checkboxCenterGlobal = tester.getCenter (find.byType (Checkbox ));
625+ final Offset checkboxCenterLocal = checkboxCenterGlobal - checkboxTopLeftGlobal;
626+ await tester.startGesture (checkboxTopLeftGlobal);
627+ await tester.pump ();
628+ // Wait for the splash to be drawn, but not long enough for it to animate towards the center, since
629+ // we want to catch it in its starting position.
630+ await tester.pump (const Duration (milliseconds: 1 ));
631+ expect (
632+ Material .of (tester.element (find.byType (Checkbox ))),
633+ paints..circle (x: checkboxCenterLocal.dx, y: checkboxCenterLocal.dy),
634+ );
635+ });
636+
605637 testWidgets ('Checkbox can be hovered and has correct hover color' , (WidgetTester tester) async {
606638 tester.binding.focusManager.highlightStrategy = FocusHighlightStrategy .alwaysTraditional;
607639 bool ? value = true ;
You can’t perform that action at this time.
0 commit comments