Created
June 13, 2020 08:57
-
-
Save doug-orchard/571adc5df2ba3e19a7d82e2eb4ca0619 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:ui'; | |
import 'package:flutter/material.dart'; | |
class FrostedContainer extends StatelessWidget { | |
final Color color; | |
final double blur; | |
final Widget child; | |
final double width; | |
final double height; | |
final double radius; | |
FrostedContainer({ | |
this.child, | |
this.width, | |
this.height, | |
this.blur = 0, | |
this.radius = 0, | |
this.color = Colors.black, | |
}); | |
@override | |
Widget build(BuildContext context) { | |
return ClipRect( | |
child: BackdropFilter( | |
filter: ImageFilter.blur(sigmaX: blur, sigmaY: blur), | |
child: Container( | |
width: width, | |
height: height, | |
child: child, | |
decoration: BoxDecoration( | |
color: color, | |
borderRadius: BorderRadius.circular(radius), | |
), | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment