コード例 #1
0
        void _paintBackgroundImage(Canvas canvas, Rect rect, ImageConfiguration configuration)
        {
            if (_decoration.image == null)
            {
                return;
            }

            _imagePainter = _imagePainter ?? _decoration.image.createPainter(onChanged);

            Path clipPath = null;

            switch (_decoration.shape)
            {
            case BoxShape.circle:
                clipPath = new Path();
                clipPath.addOval(rect);
                break;

            case BoxShape.rectangle:
                if (_decoration.borderRadius != null)
                {
                    clipPath = new Path();
                    clipPath.addRRect(_decoration.borderRadius.toRRect(rect));
                }

                break;
            }

            _imagePainter.paint(canvas, rect, clipPath, configuration);
        }
コード例 #2
0
        void _paintImage(Canvas canvas, ImageConfiguration configuration)
        {
            if (_decoration.image == null)
            {
                return;
            }

            _imagePainter = _imagePainter ?? _decoration.image.createPainter(onChanged);
            _imagePainter.paint(canvas, _lastRect, _innerPath, configuration);
        }