Rahiche / soft_edge_blur

A Flutter package that provides a customizable soft edge blur effect for widgets.
MIT License
132 stars 6 forks source link

Some Child Widgets Not Blurred #16

Open hyped0001 opened 1 month ago

hyped0001 commented 1 month ago

Simulator Screen Recording - iPhone 15 Pro - 2024-10-05 at 17 15 04

hyped0001 commented 1 month ago

SoftEdgeBlur(
            edges: [
              EdgeBlur(
                type: EdgeType.topEdge,
                size: 122,
                sigma: 150,
                tintColor: Colors.white.withValues(alpha: 0.20),
                controlPoints: [
                  ControlPoint(
                    position: 0.8,
                    type: ControlPointType.visible,
                  ),
                  ControlPoint(
                    position: 1.0,
                    type: ControlPointType.transparent,
                  ),
                ],
              )
            ],
            child: CustomScrollView(children: [...widgets here],),);
damywise commented 1 month ago

I'm not sure if this is the same problem, but I'm facing a similar issue to BackdropFilter, where some widgets behind are not getting blurred properly when I use Blendmode.srcOver. However, it works fine when I switch to Blendmode.src. The only thing is, I can't find the blendmode option in this package.

Rahiche commented 1 month ago

This widget does not take everything behind the child like BDF it just takes the content child So if you have red background and list view on top of it, using BDF will see whole thing, from the red content to the list view content

This package only sees the content of the child and blurs that content only So try to use this widget one level above to make sure the content that is not blurred is inside SoftEdgeBlur and not behind it

instead of :

-> Container(color: Colors.red)
--> SoftEdgeBlur 
---> ListView

Do:

-> SoftEdgeBlur 
--> Container(color: Colors.red)
---> ListView

Let me know if that helps @damywise and and @hyped0001

hyped0001 commented 1 month ago

We have a pretty large tree of widgets, is it possible to blur the children as well? Or would that be too heavy?

Rahiche commented 1 month ago

Yes, it is possible

The blurring will be done in the same amount of time, because you are blurring the same rectangular area but for the part where the widget tree is turned into an image using AnimatedSampler I don't know exactly how big of a difference it will be.

but I advise you try it and test in few different devices to come up with your own results