示例#1
0
        protected override void paintFeature(Canvas canvas, Matrix4 transform)
        {
            if (_painter == null)
            {
                return;
            }

            Offset             originOffset       = transform.getAsTranslation();
            ImageConfiguration sizedConfiguration = configuration.copyWith(
                size: referenceBox.size);

            if (originOffset == null)
            {
                canvas.save();
                canvas.transform(transform.storage);
                _painter.paint(canvas, Offset.zero, sizedConfiguration);
                canvas.restore();
            }
            else
            {
                _painter.paint(canvas, originOffset, sizedConfiguration);
            }
        }
示例#2
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));
        }