Code Monkey home page Code Monkey logo

Comments (7)

micahmo avatar micahmo commented on June 28, 2024 1

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.

yichaosun avatar yichaosun commented on June 28, 2024

I meet the same question, did your get the Exception, begin with A RenderFlex overflowed?

from screenshot.

yichaosun avatar yichaosun commented on June 28, 2024

actual,I warp the widget with SingleChildScrollView, still except with RenderFlex overflowed

from screenshot.

gvNN7 avatar gvNN7 commented on June 28, 2024

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.

yichaosun avatar yichaosun commented on June 28, 2024

hi bro, the widget I want to capture:

  1. sure in list view which is scrollable,I just want to capture the item ,not whole list!
  2. 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.

dachacon avatar dachacon commented on June 28, 2024

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.

AWarmHug avatar AWarmHug commented on June 28, 2024

if only on Android/iOS,try widget_screenshot,this support long screenshot, and other platform is currently under development.

from screenshot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.