Comments (7)
targetSize
is the key here. By default, it uses the device viewport. If your screenshot is overflowing vertically and you want to give it more space to grow, you can use the viewport width and a much higher value for height. This seems to work well.
final FlutterView? view = View.maybeOf(context);
final Size? viewSize = view == null ? null : view.physicalSize / view.devicePixelRatio;
final Size? targetSize = viewSize == null ? null : Size(viewSize.width, 999);
result = await screenshotController.captureFromWidget(
targetSize: targetSize,
pixelRatio: 4,
Container(), // Your widget to render
);
from screenshot.
I meet the same question, did your get the Exception, begin with A RenderFlex overflowed?
from screenshot.
actual,I warp the widget with SingleChildScrollView, still except with RenderFlex overflowed
from screenshot.
Go check this issue ( #10 ) and see if it helps.. I'm wondering if the height is taller than the screen, you're using some scrollable widget..
from screenshot.
hi bro, the widget I want to capture:
- sure in list view which is scrollable,I just want to capture the item ,not whole list!
- it works only item shorter than screen, while, when item longer than screen, it's not work
sum that, a item itself longer than screen...and in a scrollable list....
from screenshot.
Check the source code (screenshot.dart). The released code is not updated. There's a fix for this issue. You can use the targetSize.
from screenshot.
if only on Android/iOS,try widget_screenshot,this support long screenshot, and other platform is currently under development.
from screenshot.
Related Issues (20)
- FlutterError (View.of() was called with a context that does not contain a View widget. HOT 3
- The argument type 'Future<Null> Function(Uint8List)' can't be assigned to the parameter type 'FutureOr<dynamic> Function(Uint8List?)'. HOT 1
- backgroundColor of Scaffold not captured by screenshot (defaults to black) HOT 1
- No longer compiles post Flutter 3.18.0 - api changed to ViewConfiguration to take ViewConstraints instead of Size HOT 3
- No MediaQuery widget ancestor found. HOT 1
- Blank screen on IOS
- capture from long widget in version 1.3.0 HOT 3
- Ads not rending in images
- No named parameter with the name 'size' HOT 11
- 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 3
- Cannot capture Overlays HOT 1
- Capturing Screenshot doesn't work in HookWidget HOT 1
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.