public override void paint( PaintingContext context, Offset center, Animation <float> activationAnimation = null, Animation <float> enableAnimation = null, bool isDiscrete = false, bool isEnabled = false, bool?isOnTop = null, TextDirection?textDirection = null, SliderThemeData sliderTheme = null, Thumb?thumb = null ) { Canvas canvas = context.canvas; ColorTween colorTween = new ColorTween( begin: sliderTheme.disabledThumbColor, end: sliderTheme.thumbColor ); float size = _thumbSize * sizeTween.evaluate(enableAnimation); Path thumbPath = null; switch (textDirection) { case TextDirection.rtl: switch (thumb) { case Thumb.start: thumbPath = SliderDemoUtils._rightTriangle(size, center); break; case Thumb.end: thumbPath = SliderDemoUtils._leftTriangle(size, center); break; } break; case TextDirection.ltr: switch (thumb) { case Thumb.start: thumbPath = SliderDemoUtils._leftTriangle(size, center); break; case Thumb.end: thumbPath = SliderDemoUtils._rightTriangle(size, center); break; } break; } canvas.drawPath(thumbPath, new Paint { color = colorTween.evaluate(enableAnimation) }); }
public override void paint( PaintingContext context, Offset center, Animation <float> activationAnimation = null, Animation <float> enableAnimation = null, bool isDiscrete = false, TextPainter labelPainter = null, RenderBox parentBox = null, SliderThemeData sliderTheme = null, TextDirection?textDirection = null, float?value = null) { Canvas canvas = context.canvas; ColorTween enableColor = new ColorTween( begin: sliderTheme.disabledThumbColor, end: sliderTheme.valueIndicatorColor ); Tween <float> slideUpTween = new FloatTween( begin: 0.0f, end: _slideUpHeight ); float size = _indicatorSize * sizeTween.evaluate(enableAnimation); Offset slideUpOffset = new Offset(0.0f, -slideUpTween.evaluate(activationAnimation)); Path thumbPath = SliderDemoUtils._upTriangle(size, center + slideUpOffset); Color paintColor = enableColor.evaluate(enableAnimation) .withAlpha((255.0f * activationAnimation.value).round()); canvas.drawPath( thumbPath, new Paint { color = paintColor } ); canvas.drawLine( center, center + slideUpOffset, new Paint { color = paintColor, style = PaintingStyle.stroke, strokeWidth = 2.0f }); labelPainter.paint(canvas, center + slideUpOffset + new Offset(-labelPainter.width / 2.0f, -labelPainter.height - 4.0f)); }
public override void paint( PaintingContext context, Offset center, Animation <float> activationAnimation = null, Animation <float> enableAnimation = null, bool isDiscrete = false, TextPainter labelPainter = null, RenderBox parentBox = null, SliderThemeData sliderTheme = null, TextDirection?textDirection = null, float?value = null) { Canvas canvas = context.canvas; ColorTween colorTween = new ColorTween( begin: sliderTheme.disabledThumbColor, end: sliderTheme.thumbColor ); float size = _thumbSize * sizeTween.evaluate(enableAnimation); Path thumbPath = SliderDemoUtils._downTriangle(size, center); canvas.drawPath(thumbPath, new Paint { color = colorTween.evaluate(enableAnimation) }); }