screenshot icon indicating copy to clipboard operation
screenshot copied to clipboard

Allow screenshots with specific dimensions

Open nikhilmufc7 opened this issue 4 years ago • 4 comments

The plugin works pretty well, but when I export the image it is saved as a full page screenshot with the widget that I am taking screenshot of in center and black area on top and bottom. Is it possible to create dimensions that we can use to take screenshot like providing a specific height and width. Or cropping it to the specified dimensions before saving in gallery.

nikhilmufc7 avatar Jul 21 '20 15:07 nikhilmufc7

From what I have gathered the captureFromWidget method uses the ui.window.physicalSize which is probably bc it also uses ui.window. I am unsure, if this can be changed, but will try a thing or two.

This is what I've tested so far

  • [x] wrapping the method and/or the widget in a seperate MediaQuery(child: child)
  • [x] wrapping the method and/or the widget in a seperate Theme(child: child)
  • [x] wrapping the widget widget in a Sizedbox(height: 100, width: 100, child: child)
  • [ ] editing the method myself

Edit: Once I started to work on the package myself, I quickly found out, that @SachinGanesh has already solved the problem (thx for this :+1:). Unfortunately the package on pub.dev has the same package version, even though the github version is more recent. So @SachinGanesh please push the most recent version to pub.dev, so other developer do not have to waste 2h, when you already took the effort of implenting such feature :heart:.

P.S. For everyone wondering: the captureFromWidget now supports a targetSize

jlnrrg avatar Nov 29 '21 01:11 jlnrrg

Hey @jlnrrg did you find any way to calculate the targetSize automatically? I have a list of items and don't know the exact size yet.

bobatsar avatar Jun 29 '22 08:06 bobatsar

@bobatsar I solved it by only using fixed sized components and then calculating the width and height based on the amount. I know this does not answer your question unfortunately :disappointed:

jlnrrg avatar Jun 30 '22 14:06 jlnrrg

Hey @jlnrrg I am using the captureFromWidget method but I can not find the targetSize option, I need to crate screenshot of specific height and with, I am currently running version screenshot: ^1.2.3

kekko7072 avatar Jul 18 '22 16:07 kekko7072

Please use latest version of plugin to set target size. Closing this issue

ritheshSalyan avatar Mar 15 '24 07:03 ritheshSalyan