Esempio n. 1
0
        public void paint(Canvas canvas, Color color, _UiPathFactory uiPathFactory, float progress)
        {
            float opacity = AnimatedIconUtils._interpolate(opacities, progress);
            Paint paint   = new Paint();

            paint.style = PaintingStyle.fill;
            paint.color = color.withOpacity(color.opacity * opacity);
            Path path = uiPathFactory();

            foreach (_PathCommand command in commands)
            {
                command.apply(path, progress);
            }

            canvas.drawPath(path, paint);
        }
Esempio n. 2
0
 public static Widget defaultItemBuilder(
     Color color,
     bool isCurrentColor,
     GestureTapCallback changeColor
     )
 {
     return(new Container(
                margin: EdgeInsets.all(5f),
                decoration: new BoxDecoration(
                    borderRadius: BorderRadius.circular(50f),
                    color: color,
                    boxShadow: new List <BoxShadow>
     {
         new BoxShadow(
             color: color.withOpacity(0.8f),
             offset: new Offset(1f, 2f),
             blurRadius: 3f
             )         //BoxShadow
     }
                    ), //BoxDecoration
                child: new Material(
                    color: Colors.transparent,
                    child: new InkWell(
                        onTap: changeColor,
                        borderRadius: BorderRadius.circular(50f),
                        child: new AnimatedOpacity(
                            duration: new TimeSpan(0, 0, 0, 0, 210),
                            opacity: isCurrentColor ? 1f : 0f,
                            child: new Icon(
                                Icons.done,
                                color: Utils.useWhiteForeground(color) ? Colors.white : Colors.black
                                ) //Icon
                            )     //AnimatedOpacity
                        )         //InkWell
                    )             // Material
                ));
 }
Esempio n. 3
0
        public override Widget build(BuildContext context)
        {
            _AnimatedIconData iconData    = (_AnimatedIconData)icon;
            IconThemeData     iconTheme   = IconTheme.of(context);
            float             iconSize    = size ?? iconTheme.size ?? 0.0f;
            float?            iconOpacity = iconTheme.opacity;
            Color             iconColor   = color ?? iconTheme.color;

            if (iconOpacity != 1.0f)
            {
                iconColor = iconColor.withOpacity(iconColor.opacity * (iconOpacity ?? 1.0f));
            }

            return(new CustomPaint(
                       size: new Size(iconSize, iconSize),
                       painter: new _AnimatedIconPainter(
                           paths: iconData.paths,
                           progress: progress,
                           color: iconColor,
                           scale: iconSize / iconData.size.width,
                           uiPathFactory: _pathFactory
                           )
                       ));
        }