import 'dart:ui'; import 'package:flutter/material.dart'; import '../theme/app_colors.dart'; class GlassContainer extends StatelessWidget { final Widget child; final double? width; final double? height; final EdgeInsetsGeometry padding; final EdgeInsetsGeometry? margin; final double borderRadius; final double opacity; final Color? borderColor; final bool border; const GlassContainer({ super.key, required this.child, this.width, this.height, this.padding = const EdgeInsets.all(16), this.margin, this.borderRadius = 16.0, this.opacity = 0.6, this.borderColor, this.border = true, }); @override Widget build(BuildContext context) { return Container( width: width, height: height, margin: margin, child: ClipRRect( borderRadius: BorderRadius.circular(borderRadius), child: BackdropFilter( filter: ImageFilter.blur(sigmaX: 15, sigmaY: 15), child: Container( padding: padding, decoration: BoxDecoration( borderRadius: BorderRadius.circular(borderRadius), border: border ? Border.all( color: borderColor ?? Colors.white.withOpacity(0.1), width: 1, ) : null, gradient: LinearGradient( begin: Alignment.topLeft, end: Alignment.bottomRight, colors: [ AppColors.surface.withOpacity(opacity), AppColors.surface.withOpacity(opacity * 0.5), ], ), boxShadow: [ BoxShadow( color: Colors.black.withOpacity(0.2), blurRadius: 20, spreadRadius: -5, ), ], ), child: child, ), ), ), ); } }