So far I've been able to drag the widget around the screen but the scale doesn't change. I've printed the scale and it is always shown to be one.
Here's the code I've written
Positioned(
top: (_y1 - _radius1).toDouble(),
left: (_x1 - _radius1).toDouble(),
child: GestureDetector(
onScaleStart: (details) {
_baseScaleFactor = _scaleFactor;
},
onScaleUpdate: (ScaleUpdateDetails details) {
setState(() {
_scaleFactor = _baseScaleFactor * details.scale;
_radius1 = _scaleFactor * _radius1;
_x1 = min(392,
max(0, _x1 + details.focalPointDelta.dx.toInt()));
_y1 = min(512,
max(0, _y1 + details.focalPointDelta.dy.toInt()));
debugPrint("x1: $_x1\ty1: $_y1");
debugPrint("R1:$_radius1 \tScale: ${details.scale}");
debugPrint("focal: ${details.focalPoint}");
debugPrint("focal delta: ${details.focalPointDelta}");
debugPrint(
"horizontal Scale: ${details.horizontalScale}");
debugPrint("Vertical Scale: ${details.verticalScale}");
});
},
child: Container(
height: _radius1.toDouble() * 2,
width: _radius1.toDouble() * 2,
decoration: BoxDecoration(
color: const Color.fromARGB(148, 180, 60, 52),
borderRadius:
BorderRadius.circular(_radius1.toDouble()),
),
child: CustomPaint(
painter: CirclePainter(_radius1.toInt(),
_radius1.toInt(), _radius1.toInt()),
),
),
// child: CustomPaint(
// painter: CirclePainter(0, 0, _radius1),
// ),
),
),