Comments (6)
Currently Screenshot support capturing of non rendered elements. You can make use of captureFromWidget
function like shown below
screenshotController
.captureFromWidget(Container(
padding: const EdgeInsets.all(30.0),
decoration: BoxDecoration(
border:
Border.all(color: Colors.blueAccent, width: 5.0),
color: Colors.redAccent,
),
child: Text("This is an invisible widget")))
.then((capturedImage) {
ShowCapturedWidget(context, capturedImage);
});
from screenshot.
Any update ?
from screenshot.
It would be very helpful for me too!
from screenshot.
It's not possible because this package uses a RepaintBoundary
under the hood, so that means it can only take screenshot of the widgets that are rendered. What you can do is add the widgets to the screen, take a screenshot, and then remove them:
setState(() => widgetsVisible = true);
await takeScreenshot();
setState(() => widgetsVisible = false);
You can use something like overlay or dialog to hide the screen while the screenshot is happening!
from screenshot.
I am currently using the functions from here. It also uses RepaintBoundary, but no real repaints are required. Maybe something similar can be applied here.
from screenshot.
Currently Screenshot support capturing of non rendered elements. You can make use of
captureFromWidget
function like shown belowscreenshotController .captureFromWidget(Container( padding: const EdgeInsets.all(30.0), decoration: BoxDecoration( border: Border.all(color: Colors.blueAccent, width: 5.0), color: Colors.redAccent, ), child: Text("This is an invisible widget"))) .then((capturedImage) { ShowCapturedWidget(context, capturedImage); });
How do I trigger the captureFromWidget from a method, if the wifget to be captured is the Scaffold? There's my Listview with some elements outside view, and I want them on the screen shot too.
@override
Widget build(BuildContext context) {
b = build2(context);
return b;
}
void printScreen() async {
screenshotController
.captureFromWidget(Container(
padding: const EdgeInsets.all(30.0),
decoration: BoxDecoration(
border: Border.all(color: Colors.blueAccent, width: 5.0),
color: Colors.redAccent,
),
child: b))
.then((image) async {
final directory = (await getTemporaryDirectory()).path;
File imgFile =
new File('$directory/${controller.ficha.value.nome}_screenshot.png');
await imgFile.writeAsBytes(image);
Share.shareFiles(['${imgFile.path}'],
text: 'Personagem ${controller.ficha.value.nome}');
});
}
from screenshot.
Related Issues (20)
- Uint8List has 0s while taking screenshot on IOS
- arguments don't match. const ViewConfiguration({ No named parameter with the name 'size'. HOT 1
- Can't print Text to screenshot image (using command line to export image) 💦 HOT 1
- No named parameter with the name 'size' :: vs. 2.3.0 issue with Flutter (Channel master, 3.21.0-9.0.pre.29, on macOS) HOT 12
- Flutter web use HTML renderer along with screenshot controller?
- Sometimes screenshot return back null captured image HOT 1
- The argument type 'Null Function(Uint8List)' can't be assigned to the parameter type 'FutureOr<dynamic> Function(Uint8List?)'. HOT 2
- How can I remove the corner radius in an image? HOT 2
- Long widget didn't work HOT 4
- Cannot capture Overlays HOT 1
- Capturing Screenshot doesn't work in HookWidget HOT 1
- Unable to capture width screenshot in Sony Xperia IV device
- No MediaQuery widget ancestor found. HOT 2
- Screenshot fails when trying to take a screenshot - Flutter Web when website is viewed from a mobile (ios) device. HOT 2
- Not build with new flutter 3.22.0 HOT 3
- Error (Xcode): ../../../.pub-cache/hosted/pub.dev/screenshot-2.4.0/lib/screenshot.dart:165:9: Error: No named parameter with the name 'logicalConstraints'. HOT 2
- Error: No named parameter with the name 'logicalConstraints'. HOT 7
- i have update 2.3.0 to 2.4.0 and getting this error . HOT 10
- Crashes on Linux / Flutter 3.22 HOT 1
- upgrade the package to support latest flutter version v3.22.1 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from screenshot.