Commit 7fcaf093 authored by Eric Seidel's avatar Eric Seidel Committed by GitHub

Merge pull request #4573 from eseidelGoogle/switch

Fix the switch to match the Material Design spec.
parents 0d21e69b 3ee2f6f7
...@@ -158,7 +158,7 @@ class _SwitchRenderObjectWidget extends LeafRenderObjectWidget { ...@@ -158,7 +158,7 @@ class _SwitchRenderObjectWidget extends LeafRenderObjectWidget {
} }
const double _kTrackHeight = 14.0; const double _kTrackHeight = 14.0;
const double _kTrackWidth = 29.0; const double _kTrackWidth = 33.0;
const double _kTrackRadius = _kTrackHeight / 2.0; const double _kTrackRadius = _kTrackHeight / 2.0;
const double _kThumbRadius = 10.0; const double _kThumbRadius = 10.0;
const double _kSwitchWidth = _kTrackWidth - 2 * _kTrackRadius + 2 * kRadialReactionRadius; const double _kSwitchWidth = _kTrackWidth - 2 * _kTrackRadius + 2 * kRadialReactionRadius;
...@@ -355,7 +355,7 @@ class _RenderSwitch extends RenderToggleable { ...@@ -355,7 +355,7 @@ class _RenderSwitch extends RenderToggleable {
} }
// The thumb contracts slightly during the animation // The thumb contracts slightly during the animation
double inset = 2.0 - (currentPosition - 0.5).abs() * 2.0; double inset = 1.0 - (currentPosition - 0.5).abs() * 2.0;
double radius = _kThumbRadius - inset; double radius = _kThumbRadius - inset;
Rect thumbRect = new Rect.fromLTRB(thumbPosition.x + offset.dx - radius, Rect thumbRect = new Rect.fromLTRB(thumbPosition.x + offset.dx - radius,
thumbPosition.y + offset.dy - radius, thumbPosition.y + offset.dy - radius,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment