Creates a toggleable render object.
The value, activeColor, and inactiveColor arguments must not be
null.
Source
RenderToggleable({
bool value,
Size size,
Color activeColor,
Color inactiveColor,
ValueChanged<bool> onChanged,
@required TickerProvider vsync,
}) : _value = value,
_activeColor = activeColor,
_inactiveColor = inactiveColor,
_onChanged = onChanged,
_vsync = vsync,
super(additionalConstraints: new BoxConstraints.tight(size)) {
assert(value != null);
assert(activeColor != null);
assert(inactiveColor != null);
assert(vsync != null);
_tap = new TapGestureRecognizer()
..onTapDown = _handleTapDown
..onTap = _handleTap
..onTapUp = _handleTapUp
..onTapCancel = _handleTapCancel;
_positionController = new AnimationController(
duration: _kToggleDuration,
value: value ? 1.0 : 0.0,
vsync: vsync,
);
_position = new CurvedAnimation(
parent: _positionController,
curve: Curves.linear,
)..addListener(markNeedsPaint)
..addStatusListener(_handlePositionStateChanged);
_reactionController = new AnimationController(
duration: kRadialReactionDuration,
vsync: vsync,
);
_reaction = new CurvedAnimation(
parent: _reactionController,
curve: Curves.fastOutSlowIn,
)..addListener(markNeedsPaint);
}