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

not handle correctly on iphone xs with ios 18 #15

Open
Kevin301099 opened this issue Sep 28, 2024 · 2 comments
Open

not handle correctly on iphone xs with ios 18 #15

Kevin301099 opened this issue Sep 28, 2024 · 2 comments
Assignees
Labels
bug Something isn't working enhancement New feature or request

Comments

@Kevin301099
Copy link

ScreenRecording_09-28-2024.22-57-50_1.mov

code:

SoftEdgeBlur(
edges: [
EdgeBlur(
size: 300,
tintColor: Colors.transparent, // Edge Size
sigma: 30.0,
controlPoints: [
ControlPoint(position: 0.5, type: ControlPointType.visible),
ControlPoint(position: 1.0, type: ControlPointType.transparent),
],
type: EdgeType.topEdge,
),
],
child: ListView.builder(itemBuilder: (context, index) {
return Center(
child: Container(
width: 200,
height: 50,
color: Colors.blue,
child: Text(
"$index",
style: TextStyle(fontSize: 20),
),
),
);
})

@Rahiche Rahiche self-assigned this Sep 28, 2024
@Rahiche Rahiche added bug Something isn't working enhancement New feature or request labels Sep 28, 2024
@Rahiche
Copy link
Owner

Rahiche commented Oct 12, 2024

Based on the code you provided, it looks like the area that is getting blurred includes the transparent left and right sides.
If you update the color to the following, you will see the red color blending instead of the transparent one:

    return SoftEdgeBlur(
      edges: [
        EdgeBlur(
          size: 300,
          tintColor: Colors.transparent, // Edge Size
          sigma: 10.0,
          controlPoints: [
            ControlPoint(
              position: 0.5,
              type: ControlPointType.visible,
            ),
            ControlPoint(
              position: 1.0,
              type: ControlPointType.transparent,
            ),
          ],
          type: EdgeType.topEdge,
        ),
      ],
      child: Container(
        color: Colors.red,
        child: ListView.builder(itemBuilder: (context, index) {
          return Center(
            child: Container(
              width: 200,
              height: 50,
              color: Colors.blue,
              child: Text(
                "$index",
                style: TextStyle(fontSize: 20),
              ),
            ),
          );
        }),
      ),
    );
Screenshot 2024-10-12 at 22 50 47

This widget does not work like BackdropFilter where it affects all the layers; it just knows about the current widget.
So you can do the following:

  1. Apply the SoftEdgeBlur widget one level up where the background color is mixed, for example:
    return SoftEdgeBlur(
      edges: [
        EdgeBlur(
          size: 300,
          tintColor: Colors.transparent, // Edge Size
          sigma: 10.0,
          controlPoints: [
            ControlPoint(
              position: 0.5,
              type: ControlPointType.visible,
            ),
            ControlPoint(
              position: 1.0,
              type: ControlPointType.transparent,
            ),
          ],
          type: EdgeType.topEdge,
        ),
      ],
      child: Material(
        color: Colors.white,
        child: ListView.builder(itemBuilder: (context, index) {
          return Center(
            child: Container(
              width: 200,
              height: 50,
              color: Colors.blue,
              child: Text(
                "$index",
                style: TextStyle(fontSize: 20),
              ),
            ),
          );
        }),
      ),
    );
Screenshot 2024-10-12 at 22 55 39
  1. Update your tree so that the SoftEdgeBlur widget doesn't capture transparent color by setting the constraints at the top:
    return Material(
      color: Colors.white,
      child: Center(
        child: SizedBox(
          width: 200,
          child: SoftEdgeBlur(
            edges: [
              EdgeBlur(
                size: 300,
                tintColor: Colors.transparent, // Edge Size
                sigma: 10.0,
                controlPoints: [
                  ControlPoint(
                    position: 0.5,
                    type: ControlPointType.visible,
                  ),
                  ControlPoint(
                    position: 1.0,
                    type: ControlPointType.transparent,
                  ),
                ],
                type: EdgeType.topEdge,
              ),
            ],
            child: ListView.builder(itemBuilder: (context, index) {
              return Container(
                width: 200,
                height: 50,
                color: Colors.blue,
                child: Text(
                  "$index",
                  style: TextStyle(fontSize: 20),
                ),
              );
            }),
          ),
        ),
      ),
    );
Screenshot 2024-10-12 at 23 00 01

@Kevin301099
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants