setPos method
Move this inner rect
Implementation
void setPos(Offset tl) {
if (!isReady()) return;
final Offset br =
tl + Offset(region.width.toDouble(), region.height.toDouble());
int left = tl.dx.toInt();
int right = br.dx.toInt();
int top = tl.dy.toInt();
int bottom = br.dy.toInt();
final int stkWidCenter = innerRectStrokeWidth ~/ 2;
if (tl.dx < stkWidCenter || br.dx > imageWidth - stkWidCenter) {
left = region.x1;
right = region.x2;
}
if (tl.dy < stkWidCenter || br.dy > imageHeight - stkWidCenter) {
top = region.y1;
bottom = region.y2;
}
region = Region(
x1: left.toInt(),
y1: top.toInt(),
x2: right.toInt(),
y2: bottom.toInt());
}