Is it possible to make watermark with stack when the image is over widget and still can interact with the widgets behind?

Viewed 192

So, I'm building apps with flutter and have some cases when watermark is needed for some page. I have solution for this problem using Stack Widget, but more problem comes. The problem are:

  1. I need the watermark can cover all the screen.
  2. I've try using Positioned with Image behind widgets, but the widgets that have background cover my watermark and cannot be seen well.
//Code to make watermark behind widgets
Stack (
  children : [
    Positioned(
      child: Center(
        child: Opacity(
          opacity: 0.1,
          child: Image.asset("path/to/images.png", fit: BoxFit.contain)
        ),
      ),
    ),
    AllMyScreenWidgets(),
  ]
)
  1. When Positioned widget with Image is over the widgets, you can see all watermark and that's good but you can't interact with the widgets behind.
//Code to make watermark over widgets
Stack (
  children : [
    AllMyScreenWidgets(),
    Positioned(
      child: Center(
        child: Opacity(
          opacity: 0.1,
          child: Image.asset("path/to/images.png", fit: BoxFit.contain)
        ),
      ),
    ),
  ]
)

Is it possible to keep use Stack Widget? or there any advice, solution, trick or tips about this problem?

Thanks

1 Answers

try IgnorePointer:

//Code to make watermark over widgets
Stack (
  children : [
    AllMyScreenWidgets(),
    Positioned(
      child: IgnorePointer(ignoring: true,
        child: Center(
          child: Opacity(
            opacity: 0.1,
            child: Image.asset("path/to/images.png", fit: BoxFit.contain)
          ),
        ),
      ),
    ),
  ]
)
Related