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

Ingnore Pointer Added #7

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions lib/blur.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import 'package:flutter/material.dart';
///[colorOpacity] is the opacity of the blurColor (default value = 0.5)
///[overlay] is the widget that can be stacked over blurred widget
///[alignment] is the alignment geometry of the overlay (default value = Alignment.center)
///[ignorePointer] is the ignore click blur and overlay when you can't click child widgets (default value = false)
class Blur extends StatelessWidget {
const Blur({
Key? key,
Expand All @@ -20,6 +21,7 @@ class Blur extends StatelessWidget {
this.colorOpacity = 0.5,
this.overlay,
this.alignment = Alignment.center,
this.ignorePointer = false,
}) : super(key: key);

final Widget child;
Expand All @@ -29,7 +31,8 @@ class Blur extends StatelessWidget {
final double colorOpacity;
final Widget? overlay;
final AlignmentGeometry alignment;

final bool ignorePointer;

@override
Widget build(BuildContext context) {
return ClipRRect(
Expand All @@ -38,14 +41,17 @@ class Blur extends StatelessWidget {
children: [
child,
Positioned.fill(
child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: blur, sigmaY: blur),
child: Container(
decoration: BoxDecoration(
color: blurColor.withOpacity(colorOpacity),
child: IgnorePointer(
ignoring: ignorePointer,
child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: blur, sigmaY: blur),
child: Container(
decoration: BoxDecoration(
color: blurColor.withOpacity(colorOpacity),
),
alignment: alignment,
child: overlay,
),
alignment: alignment,
child: overlay,
),
),
),
Expand Down