Ejemplo n.º 1
0
        public override void paint(
            PaintingContext context,
            Offset center,
            Animation <float> activationAnimation = null,
            Animation <float> enableAnimation     = null,
            bool?isDiscrete             = null,
            TextPainter labelPainter    = null,
            RenderBox parentBox         = null,
            SliderThemeData sliderTheme = null,
            float?value = null
            )
        {
            Canvas     canvas      = context.canvas;
            FloatTween radiusTween = new FloatTween(
                begin: 0.0f,
                end: this.overlayRadius
                );

            canvas.drawCircle(
                center,
                radiusTween.evaluate(activationAnimation),
                new Paint {
                color = sliderTheme.overlayColor
            }
                );
        }
Ejemplo n.º 2
0
        public override Widget build(BuildContext context)
        {
            ShapeBorder shape     = _border.evaluate(animation);
            float       elevation = _elevation.evaluate(animation);

            return(new PhysicalShape(
                       child: new _ShapeBorderPaint(
                           child: widget.child,
                           shape: shape,
                           borderOnForeground: widget.borderOnForeground),
                       clipper: new ShapeBorderClipper(
                           shape: shape),
                       clipBehavior: widget.clipBehavior,
                       elevation: _elevation.evaluate(animation),
                       color: ElevationOverlay.applyOverlay(context, widget.color, elevation),
                       shadowColor: _shadowColor.evaluate(animation)
                       ));
        }
Ejemplo n.º 3
0
 public override Widget build(BuildContext context)
 {
     return(new PhysicalModel(
                child: widget.child,
                shape: widget.shape,
                clipBehavior: widget.clipBehavior,
                borderRadius: _borderRadius.evaluate(animation),
                elevation: _elevation.evaluate(animation),
                color: widget.animateColor ? _color.evaluate(animation) : widget.color,
                shadowColor: widget.animateShadowColor
             ? _shadowColor.evaluate(animation)
             : widget.shadowColor));
 }
Ejemplo n.º 4
0
        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));
        }
Ejemplo n.º 5
0
        public override void paint(Canvas canvas, Size size)
        {
            float selectedItemOffset = getSelectedItemOffset();

            FloatTween top = new FloatTween(
                begin: selectedItemOffset.clamp(0.0f, size.height - material_._kMenuItemHeight),
                end: 0.0f
                );

            FloatTween bottom = new FloatTween(
                begin: (top.begin + material_._kMenuItemHeight).clamp(material_._kMenuItemHeight,
                                                                      size.height),
                end: size.height
                );

            Rect rect = Rect.fromLTRB(0.0f, top.evaluate(resize), size.width, bottom.evaluate(resize));

            _painter.paint(canvas, rect.topLeft, new ImageConfiguration(size: rect.size));
        }
Ejemplo n.º 6
0
        public override void paint(Canvas canvas, Size size)
        {
            float selectedItemOffset = this.selectedIndex ?? 0 * DropdownConstants._kMenuItemHeight +
                                       Constants.kMaterialListPadding.top;
            FloatTween top = new FloatTween(
                begin: selectedItemOffset.clamp(0.0f, size.height - DropdownConstants._kMenuItemHeight),
                end: 0.0f
                );

            FloatTween bottom = new FloatTween(
                begin: (top.begin + DropdownConstants._kMenuItemHeight).clamp(DropdownConstants._kMenuItemHeight,
                                                                              size.height),
                end: size.height
                );

            Rect rect = Rect.fromLTRB(0.0f, top.evaluate(this.resize), size.width, bottom.evaluate(this.resize));

            this._painter.paint(canvas, rect.topLeft, new ImageConfiguration(size: rect.size));
        }
 public override void paint(Canvas canvas, Size size)
 {
     foreach (_Circle circle in this.circles)
     {
         Paint paint = new Paint();
         paint.color = circle.color;
         Rect rect = Rect.fromLTWH(0.0f, 0.0f, size.width, size.height);
         canvas.clipRect(rect);
         float      leftFraction = circle.horizontalLeadingOffset;
         Offset     center       = new Offset(leftFraction * size.width, size.height / 2.0f);
         FloatTween radiusTween  = new FloatTween(
             begin: 0.0f,
             end: _maxRadius(center, size)
             );
         canvas.drawCircle(
             center,
             radiusTween.evaluate(circle.animation),
             paint
             );
     }
 }