Skip to content

Instantly share code, notes, and snippets.

@FelipeSantos75
Last active January 25, 2022 12:48
Show Gist options
  • Save FelipeSantos75/f665b7870f200b3e5dd446eef850b98c to your computer and use it in GitHub Desktop.
Save FelipeSantos75/f665b7870f200b3e5dd446eef850b98c to your computer and use it in GitHub Desktop.
glass
import 'dart:ui';
import 'package:flutter/material.dart';
class GlassMorphism extends StatelessWidget {
final Widget child;
final double start;
final double end;
const GlassMorphism({
Key? key,
required this.child,
required this.start,
required this.end,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return ClipRRect(
child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 3, sigmaY: 3),
child: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
Colors.white.withOpacity(start),
Colors.white.withOpacity(end),
],
begin: AlignmentDirectional.topStart,
end: AlignmentDirectional.bottomEnd,
),
borderRadius: BorderRadius.all(Radius.circular(10)),
border: Border.all(
width: 1.5,
color: Colors.white.withOpacity(0.2),
),
),
child: child,
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment