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

Is there a way to have a backdrop filter (blur) for the barrier instead of just a color? #208

Open
mark8044 opened this issue Jul 25, 2024 · 1 comment
Assignees
Labels
feature request New feature or request P2
Milestone

Comments

@mark8044
Copy link

Is there a way to have a backdrop filter (blur) for the barrier instead of just a color?

Ideally with animation as well (so the blur can come in and out). This is currently possible with Sheets/ModalBottomSheet package as we are given a builder to work with and would be a wonderful addition here

@fujidaiti fujidaiti added feature request New feature or request P2 labels Jul 30, 2024
@fujidaiti fujidaiti added this to the stable milestone Jul 30, 2024
@fujidaiti
Copy link
Owner

Hi @mark8044,

Currently, there is no convenient way to add a custom modal barrier. However, you can extend ModalSheetRoute and override buildModalBarrier() to customize the barrier creation logic:

class CustomModalSheetRoute extends ModalSheetRoute {
  CustomModalSheetRoute({
    super.settings,
    super.fullscreenDialog,
    required super.builder,
    super.maintainState,
    super.barrierDismissible,
    super.barrierLabel,
    super.barrierColor,
    super.swipeDismissible,
    super.transitionDuration,
    super.transitionCurve,
  });
  
  @override
  Widget buildModalBarrier() {
    void onDismiss() {
      if (animation!.isCompleted && !navigator!.userGestureInProgress) {
        navigator?.maybePop();
      }
    }
    
    return CustomModalBarrier(
      onDismiss: onDismiss,
      ...
    );
  }
}

@fujidaiti fujidaiti self-assigned this Jul 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request P2
Projects
None yet
Development

No branches or pull requests

2 participants