diff --git a/lib/src/widgets/yaru_togglable.dart b/lib/src/widgets/yaru_togglable.dart index 2adecd445..d29ea141a 100644 --- a/lib/src/widgets/yaru_togglable.dart +++ b/lib/src/widgets/yaru_togglable.dart @@ -10,7 +10,7 @@ const _kTogglableSizeAnimationDuration = Duration(milliseconds: 100); const _kIndicatorAnimationDuration = Duration(milliseconds: 200); const _kIndicatorRadius = 20.0; // Used to resize the canvas on active state. Must be an even number. -const _kTogglableActiveResizeFactor = .1; +const _kTogglableActiveResizeFactor = 2; /// A generic class to create a togglable widget /// @@ -427,7 +427,14 @@ abstract class YaruTogglablePainter extends ChangeNotifier @override void paint(Canvas canvas, Size size) { final origin = (Offset.zero & size).center; - final scale = 1 - _kTogglableActiveResizeFactor * sizePosition.value; + + final activeScaleX = + 1 - (size.width - _kTogglableActiveResizeFactor) / size.width; + final activeScaleY = + 1 - (size.height - _kTogglableActiveResizeFactor) / size.height; + final activeScale = + activeScaleX > activeScaleY ? activeScaleX : activeScaleY; + final scale = 1 - activeScale * sizePosition.value; canvas.save(); canvas.translate(origin.dx, origin.dy); diff --git a/test/widgets/goldens/yaru_switch-checked-pressed-dark.png b/test/widgets/goldens/yaru_switch-checked-pressed-dark.png index 9484a438c..1e82ee9dc 100644 Binary files a/test/widgets/goldens/yaru_switch-checked-pressed-dark.png and b/test/widgets/goldens/yaru_switch-checked-pressed-dark.png differ diff --git a/test/widgets/goldens/yaru_switch-checked-pressed-light.png b/test/widgets/goldens/yaru_switch-checked-pressed-light.png index a4f455d76..fe1b9f338 100644 Binary files a/test/widgets/goldens/yaru_switch-checked-pressed-light.png and b/test/widgets/goldens/yaru_switch-checked-pressed-light.png differ diff --git a/test/widgets/goldens/yaru_switch-unckecked-pressed-dark.png b/test/widgets/goldens/yaru_switch-unckecked-pressed-dark.png index e97434b50..920bc9a86 100644 Binary files a/test/widgets/goldens/yaru_switch-unckecked-pressed-dark.png and b/test/widgets/goldens/yaru_switch-unckecked-pressed-dark.png differ diff --git a/test/widgets/goldens/yaru_switch-unckecked-pressed-light.png b/test/widgets/goldens/yaru_switch-unckecked-pressed-light.png index 51a253567..a8df8ba2b 100644 Binary files a/test/widgets/goldens/yaru_switch-unckecked-pressed-light.png and b/test/widgets/goldens/yaru_switch-unckecked-pressed-light.png differ diff --git a/test/widgets/goldens/yaru_switch_button-off-pressed-dark.png b/test/widgets/goldens/yaru_switch_button-off-pressed-dark.png index 7d701c9fd..0b72bf7ea 100644 Binary files a/test/widgets/goldens/yaru_switch_button-off-pressed-dark.png and b/test/widgets/goldens/yaru_switch_button-off-pressed-dark.png differ diff --git a/test/widgets/goldens/yaru_switch_button-off-pressed-light.png b/test/widgets/goldens/yaru_switch_button-off-pressed-light.png index 3356e526c..821c8ebea 100644 Binary files a/test/widgets/goldens/yaru_switch_button-off-pressed-light.png and b/test/widgets/goldens/yaru_switch_button-off-pressed-light.png differ diff --git a/test/widgets/goldens/yaru_switch_button-on-pressed-dark.png b/test/widgets/goldens/yaru_switch_button-on-pressed-dark.png index e991d99c6..04aded1cf 100644 Binary files a/test/widgets/goldens/yaru_switch_button-on-pressed-dark.png and b/test/widgets/goldens/yaru_switch_button-on-pressed-dark.png differ diff --git a/test/widgets/goldens/yaru_switch_button-on-pressed-light.png b/test/widgets/goldens/yaru_switch_button-on-pressed-light.png index 1538763b5..01299a7fb 100644 Binary files a/test/widgets/goldens/yaru_switch_button-on-pressed-light.png and b/test/widgets/goldens/yaru_switch_button-on-pressed-light.png differ diff --git a/test/widgets/goldens/yaru_switch_list_tile-off-pressed-dark.png b/test/widgets/goldens/yaru_switch_list_tile-off-pressed-dark.png index 4a2fc0a01..2668e9689 100644 Binary files a/test/widgets/goldens/yaru_switch_list_tile-off-pressed-dark.png and b/test/widgets/goldens/yaru_switch_list_tile-off-pressed-dark.png differ diff --git a/test/widgets/goldens/yaru_switch_list_tile-off-pressed-light.png b/test/widgets/goldens/yaru_switch_list_tile-off-pressed-light.png index 6d10677e8..b157bf161 100644 Binary files a/test/widgets/goldens/yaru_switch_list_tile-off-pressed-light.png and b/test/widgets/goldens/yaru_switch_list_tile-off-pressed-light.png differ diff --git a/test/widgets/goldens/yaru_switch_list_tile-on-pressed-dark.png b/test/widgets/goldens/yaru_switch_list_tile-on-pressed-dark.png index eb0677857..6d97e143c 100644 Binary files a/test/widgets/goldens/yaru_switch_list_tile-on-pressed-dark.png and b/test/widgets/goldens/yaru_switch_list_tile-on-pressed-dark.png differ diff --git a/test/widgets/goldens/yaru_switch_list_tile-on-pressed-light.png b/test/widgets/goldens/yaru_switch_list_tile-on-pressed-light.png index ca8817da7..c157a1651 100644 Binary files a/test/widgets/goldens/yaru_switch_list_tile-on-pressed-light.png and b/test/widgets/goldens/yaru_switch_list_tile-on-pressed-light.png differ