1
1
# SoftEdgeBlur
2
2
3
- A Flutter widget that applies a soft, blurred edge effect to its child widget. This package allows you to easily add a subtle, fading blur effect to the top and/or bottom edges of any widget, creating a smooth transition between content and background .
3
+ A Flutter package that provides a customizable soft edge blur effect for widgets .
4
4
5
- <img width =" 547 " alt =" Screenshot 2024-09-10 at 23 04 14 " src =" https://github. com/user-attachments/assets/ba58e8a7-a499-46b0-8f41-6eb74dfb8738 " >
5
+ <img width =" 547 " alt =" Map blurred " src =" https://i.imgur. com/7DcixDz.png " >
6
6
7
+ ## Example
8
+ | ![ ] ( https://i.imgur.com/ZHTocas.png ) | ![ ] ( https://i.imgur.com/ejYRoGu.png ) |
9
+ | --------------------------------------| --------------------------------------|
10
+ | ![ ] ( https://i.imgur.com/2B4RJo2.png ) | ![ ] ( https://i.imgur.com/lrVGtHU.png ) |
7
11
8
- ## Getting Started
9
-
10
- To use this package, add ` soft_edge_blur ` as a dependency in your ` pubspec.yaml ` file.
11
-
12
- ``` yaml
13
- dependencies :
14
- soft_edge_blur :
15
- ` ` `
16
-
17
- Then, run:
18
-
19
- ` ` `
20
- flutter pub get
21
- ```
22
12
23
13
## Usage
24
14
@@ -33,30 +23,60 @@ Wrap any widget with `SoftEdgeBlur` to apply the blur effect:
33
23
``` dart
34
24
SoftEdgeBlur(
35
25
edges: [
36
- EdgeBlur(EdgeType.topEdge, 20, 3),
26
+ EdgeBlur(
27
+ EdgeType.topEdge,
28
+ 100.0, // Edge Size
29
+ 20.0, // Blur Sigma
30
+ controlPoints: [
31
+ ControlPoint(position: 0.5, type: ControlPointType.visible),
32
+ ControlPoint(position: 1.0, type: ControlPointType.transparent),
33
+ ],
34
+ ),
37
35
],
38
36
child: YourWidget(),
39
37
)
40
38
```
41
39
42
- ### Parameters
40
+ ## Customization
43
41
44
- - ` edges ` : A list of ` EdgeBlur ` objects defining which edges to blur and their properties.
45
- - ` child ` : The widget to which the blur effect will be applied.
42
+ You can customize the following properties for each edge:
46
43
47
- Each ` EdgeBlur ` object takes three parameters:
48
- 1 . ` EdgeType ` : Either ` EdgeType.topEdge ` or ` EdgeType.bottomEdge `
49
- 2 . ` size ` : The size of the blurred area in logical pixels
50
- 3 . ` sigma ` : The intensity of the blur effect
44
+ ### Edge Type
51
45
46
+ Specify which edges to apply the blur effect:
52
47
53
- ## Demo
48
+ - ` EdgeType.topEdge `
49
+ - ` EdgeType.bottomEdge `
50
+ - ` EdgeType.leftEdge `
51
+ - ` EdgeType.rightEdge `
54
52
55
- Check out this video to see ` SoftEdgeBlur ` in action:
53
+ You can apply blur to multiple edges simultaneously.
56
54
55
+ ### Edge Size
57
56
57
+ Set the size of the blurred area. This determines how far the blur effect extends from the edge of the widget.
58
58
59
+ ### Blur Sigma
59
60
60
- https://github.com/user-attachments/assets/e42d79ab-657d-4a1b-90be-5fbd44f1a957
61
+ Adjust the intensity of the blur effect.
61
62
63
+ ### Control Points
62
64
65
+ Define points to control the blur gradient along the edge. Each control point has two properties:
66
+
67
+ - ` position ` : A value between 0.0 and 1.0, representing the position along the edge.
68
+ - ` type ` : Either ` ControlPointType.visible ` or ` ControlPointType.transparent ` .
69
+
70
+
71
+ ### Example Configuration
72
+
73
+ ``` dart
74
+ EdgeBlur(
75
+ EdgeType.topEdge,
76
+ 100.0, // Edge Size
77
+ 20.0, // Blur Sigma
78
+ controlPoints: [
79
+ ControlPoint(position: 0.5, type: ControlPointType.visible),
80
+ ControlPoint(position: 1.0, type: ControlPointType.transparent),
81
+ ],
82
+ ),
0 commit comments