screenshot
screenshot copied to clipboard
Screenshot not coming fully
I'm having multiple tables which are introduced inside a SingleChildScrollView. I'm using the Screensot as the parent widget in the body of the Scaffold, but when i caputre the screenshot I'm just getting the image only which is visible to the user but not all the tables when scrolled down/up.
ScreenshotController screenshotController = ScreenshotController();
body: Screenshot(
controller: screenshotController,
child: TabBarView(
children: [
SingleChildScrollView(
child: Padding(
padding: EdgeInsets.only(bottom: 50.h.toDouble()),
child: Column(children: v0),
),
),
SingleChildScrollView(child: Column(children: v1)),
SingleChildScrollView(child: Column(children: v2)),
SingleChildScrollView(child: Column(children: v3)),
],
controller: _tabController,
),
),
And the onPress function while capturing the screenshot
CaptureScreenshot() async {
final uint8List = await screenshotController.capture();
String tempPath = (await getTemporaryDirectory()).path;
File file = File('$tempPath/image.png');
await file.writeAsBytes(uint8List!);
await Share.shareFiles([file.path]);
}
And as i've went through other answers in issues found that the ScreenShot widget should be placed inside a SingleChildScrollView but if i use the SingleChildScrollView as the parent widget for the ScreenShot widget I'm getting an error as
RenderBox was not laid out: RenderRepaintBoundary#4b20b relayoutBoundary=up1 NEEDS-PAINT
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1930 pos 12: 'hasSize'
Either the assertion indicates an error in the framework itself, or we should provide substantially more information in this error message to help you determine and fix the underlying cause.
We have added a new method captureFromWidget
. Can you try with this and see if it works?
No even for that one too in the preview it was showing only of the content in the screen not of the whole page
Any solution for this?
Same here. @SachinGanesh help
Did you solved @NiroopNife ? Is this package dead??
So I am not sure about the real cause under the hood, but I had some SizedBox
widgets for spacing and they caused the problem of the cutoff.
Remove them and you will see the whole view. You can replace them with padding widgets.
Another thing you can do is making the view longer, I know this seems wierd but it worked like a charm.
You can provide a target size and set the desired resolution to capture screenshot.
Closing this issue. If you think it is incorrect, please reopen the issue