if top midpoint drag for image crop that time image also crop from bottom side in flutter

12 Views Asked by At

i have one resizable draggable container. in this container i have to four midpoint for the crop image but when i have drag top side midpoint for the crop image for the top side that time also bottom side border through image crop.

i have only if top mid point drag so only top side of image crop other still same.

this is image property.

child: Container(
              height: height,
              width: width,
              alignment: Alignment.center,
               padding: EdgeInsets.all(2.0),
              decoration:
                   BoxDecoration(
                color: Colors.transparent,
                border: Border.all(
                  width: 2,
                  color: _isSelected ? Colors.black : Colors.transparent,
                ),
              ),


              child: ClipRect(
                child: Align(alignment: Alignment(
                  left / width,
                  top / height,
                ),
                  child: Image.asset(
                      'images/rose1.png',
                      width: width,
                      height: height,
                      fit: BoxFit.cover,
                  ),
                ),
              ),
            ),

and this is top mid point function

if (_isSelected && (width > 10 && height > 10))
        Positioned(
          top: top - ballDiameter / 2,
          left: left + width / 2 - ballDiameter / 2,
          child: ManipulatingBall(
            onDrag: (dx, dy) {
              var newHeight = height - dy ;
              var newTop = top + dy;
              setState(() {
                if (newHeight > 10 ) {
                  height = newHeight;
                  top = newTop;
                }
              });
            },
            handlerWidget: HandlerWidget.HORIZONTAL,
          ),
        ),

enter image description here enter image description here

0

There are 0 best solutions below