Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clipBehavior = Clip.none #53

Closed
fernando-s97 opened this issue Jun 25, 2021 · 2 comments
Closed

clipBehavior = Clip.none #53

fernando-s97 opened this issue Jun 25, 2021 · 2 comments

Comments

@fernando-s97
Copy link

Is it possible to take the screenshot of this entire widget?

Stack(
  clipBehavior: Clip.none,
  alignment: Alignment.center,
  children: [
    Container(
      color: Colors.red,
      width: 20,
      height: 20,
    ),
    Positioned(
      top: -10,
      child: Container(
        color: Colors.green,
        width: 20,
        height: 20,
      ),
    ),
    Positioned(
      top: -20,
      child: Container(
        color: Colors.bue,
        width: 20,
        height: 20,
      ),
    ),
  ],
)

I'm only getting the first one and the half of the second one; probably because the other ones are being overflown

@ritheshSalyan
Copy link
Collaborator

@fernando-s97 You Make use of captureFromWidget function to capture overflowing widget as below

  screenshotController
                    .captureFromWidget(Container(
                        padding: const EdgeInsets.all(20.0),
                        child: Stack(
                          clipBehavior: Clip.none,
                          alignment: Alignment.center,
                          children: [
                            Container(
                              color: Colors.red,
                              width: 20,
                              height: 20,
                            ),
                            Positioned(
                              top: -10,
                              left: -10,
                              child: Container(
                                color: Colors.green,
                                width: 20,
                                height: 20,
                              ),
                            ),
                            Positioned(
                              top: -20,
                              child: Container(
                                color: Colors.blue,
                                width: 20,
                                height: 20,
                              ),
                            ),
                          ],
                        )))
                    .then((capturedImage) {
                  ShowCapturedWidget(context, capturedImage);
                });

Screenshot_20210709-135834

@fernando-s97
Copy link
Author

fernando-s97 commented Jul 9, 2021

Got the idea! I guess that's only way then. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants