how to take screenshot of specific area on the screen in flutter?
672
well i don't know about x and y but what you can do is screen shot of specific widgets with package screenshot
, link
this package capture widgets as Images, even if they are not rendered on screen.
Step 1: create a controller
ScreenshotController screenshotController = ScreenshotController();
Step 2: wrap widgets with Screenshot()
Screenshot(
controller: screenshotController,
child: Text("This text will be captured as image"),
),
step 3: Take the screenshot by calling capture method. This will return a Uint8List
screenshotController.capture().then((Uint8List image) {
//Capture Done
setState(() {
_imageFile = image;
});
}).catchError((onError) {
print(onError);
});
Author by