Code Monkey home page Code Monkey logo

Comments (6)

ebot64 avatar ebot64 commented on July 21, 2024 1

I encountered this issue after implementing both dark and light themes in my app.

In a similar screenshot package with same issue, suggestion was to wrap the widget with white background container. While this may work for light theme, it defeats the purpose for dark theme. See issue here

In my case, when app is in dark theme, screenshot image appears as expected without including the white background container; but in light theme, screenshot image appears blackened. If I include the container with white background, the blackened screenshot switches between the themes --> screenshot image now appears okay in light theme and becomes blackened in dark theme.

My work around is to check the current theme and use Colors.transparent for dark theme and Colors.white for light theme as below. This works in whatever theme mode.

Screenshot(
  controller: screenshotController,
  child: Container(
    color: isDarkModeEnabled
        ? Colors.transparent
        : Colors.white,
    child: WidgetToBeShared(),
  )
)

from screenshot.

kw2019ltd avatar kw2019ltd commented on July 21, 2024

if i warp the widget with Card instead of Container its working fine with light mode(note: in dark mode its working with both Card and Container)

from screenshot.

ritheshSalyan avatar ritheshSalyan commented on July 21, 2024

@kw2019ltd Are you using any background color in theme?

from screenshot.

Marcusjnr avatar Marcusjnr commented on July 21, 2024

I had this same issue to, I solved it by giving the container a background color of white

from screenshot.

YouSour avatar YouSour commented on July 21, 2024

i got this problem too, anyone solve it , yet ?

from screenshot.

ritheshSalyan avatar ritheshSalyan commented on July 21, 2024

Wrap your widget with the container and provide color to it. This will change the background color of your widget.

Closing this issue. If you think it is incorrect please feel free to reopen.

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.