Skip to content

Instantly share code, notes, and snippets.

@doug-orchard
Created June 13, 2020 08:57
Show Gist options
  • Save doug-orchard/571adc5df2ba3e19a7d82e2eb4ca0619 to your computer and use it in GitHub Desktop.
Save doug-orchard/571adc5df2ba3e19a7d82e2eb4ca0619 to your computer and use it in GitHub Desktop.
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