mirror of
https://github.com/R0m1k3/xtremflow.git
synced 2026-10-11 17:30:00 +02:00
58 lines
1.5 KiB
Dart
58 lines
1.5 KiB
Dart
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: 10, sigmaY: 10),
|
|
child: Container(
|
|
padding: padding,
|
|
decoration: BoxDecoration(
|
|
color: AppColors.surface.withOpacity(opacity),
|
|
borderRadius: BorderRadius.circular(borderRadius),
|
|
border: border
|
|
? Border.all(
|
|
color: borderColor ?? Colors.white.withOpacity(0.1),
|
|
width: 1,
|
|
)
|
|
: null,
|
|
),
|
|
child: child,
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|