Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Blur background behind dialog flutter? [closed]

Tags:

dialog

flutter

I want to achieve blur background behind dialog on SimpleDialog class. What I'm looking for is something similar to this, but for flutter.

Github Android project

EDIT: I already checked this question, but this is about the Dialog, I want to implement it on SimpleDialog.

like image 975
Shaheen Zahedi Avatar asked Aug 13 '18 15:08

Shaheen Zahedi


People also ask

How do you blur the background of a dialog box in flutter?

In flutter, The dimming effect behind the dialog and bottom sheets is done using a class named 'ModalBarrier'. So what you can do is just modify the code where it dims the background. child: color == null ? null : BackdropFilter( filter: new ImageFilter.

How do I change the background color of alert dialog in flutter?

You need to wrap your Dialog in a Builder like this. After that dialogBackgroundColor will have an effect. Show activity on this post. You can now use backgroundColor property of AlertDialog to change the color.


1 Answers

Just wrap your Dialog inside BackdropFilter

return new BackdropFilter(
    filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10),
    child: Dialog(
      shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(15.0)),
      backgroundColor: Color(ColorResources.BLACK_ALPHA_65),
      child: _dialogContent(),
    )
);

Widget _dialogContent() {}//Your dialog view
like image 170
Vikrant Avatar answered Oct 17 '22 00:10

Vikrant