Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get xy , width and rotation angle #38

Open
simranKa opened this issue Mar 4, 2024 · 0 comments
Open

Get xy , width and rotation angle #38

simranKa opened this issue Mar 4, 2024 · 0 comments

Comments

@simranKa
Copy link

simranKa commented Mar 4, 2024

I am using this widget in video editing app. I have implemented it successfully but not getting how to get left,top, width and roatation angle to save video with watermark. This is my code:

MatrixGestureDetector(
onMatrixUpdate: (m, tm, sm, rm) {
controller.matrix = MatrixGestureDetector.compose(m, tm, sm, rm);
notifier.value++;
},
child: AspectRatio(
aspectRatio: controller.aspectRatio.value != 0.0 ? controller.aspectRatio.value : controller.controller.video.value.aspectRatio,
child: AnimatedBuilder(
animation: notifier,
builder: (ctx, child) {
return Transform(
transform: controller.matrix,
child: MeasureSize(
onChange: (Size size) { controller.size = size; },
child: FittedBox(
fit: BoxFit.contain,
child: controller.icon == null ? CustomPaint(
painter: DottedBorderPainter(),
child: Obx(() => Container(
color: Color(controller.bgColor.value != 0 ? controller.bgColor.value : Colors.transparent.value),
margin: const EdgeInsets.all(4),
padding: const EdgeInsets.all(4),
child: Center(
child: Text(key: controller.textKey, controller.text,
style: TextStyle(fontSize: 33.5,
color: Color(controller.textColor.value != 0 ? controller.textColor.value : Colors.black.value))),
),
)),
)
: Container(key: controller.key, child: Image.network(controller.icon!))
),
),
);
},
),
),
)

and I have used :
var x = MatrixUtils.transformRect(matrix, key.currentContext!.findRenderObject()!.paintBounds).left;
var y = MatrixUtils.transformRect(matrix, key.currentContext!.findRenderObject()!.paintBounds).top;

   var width = MatrixUtils.transformRect(matrix, key.currentContext!.findRenderObject()!.paintBounds).width;

to get corrdinates and width and not sure about rotation but these are not working

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant