119 lines
2.9 KiB
Dart
119 lines
2.9 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import '../../../common/theme/theme.dart';
|
|
|
|
class GradientCard extends StatelessWidget {
|
|
final Widget child;
|
|
final List<Color>? gradientColors;
|
|
final double borderRadius;
|
|
final EdgeInsetsGeometry? padding;
|
|
final bool showDecoration;
|
|
|
|
const GradientCard({
|
|
super.key,
|
|
required this.child,
|
|
this.gradientColors,
|
|
this.borderRadius = 16,
|
|
this.padding = const EdgeInsets.all(16.0),
|
|
this.showDecoration = true,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
decoration: BoxDecoration(
|
|
gradient: LinearGradient(
|
|
colors: gradientColors ?? AppColor.primaryGradient,
|
|
begin: Alignment.topLeft,
|
|
end: Alignment.bottomRight,
|
|
),
|
|
borderRadius: BorderRadius.circular(borderRadius),
|
|
),
|
|
child: Stack(
|
|
children: [
|
|
// Background Pattern (optional)
|
|
if (showDecoration) ..._buildDecorations(),
|
|
// Main Content
|
|
Padding(padding: padding ?? EdgeInsets.zero, child: child),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
List<Widget> _buildDecorations() {
|
|
return [
|
|
// Top Right Circle
|
|
Positioned(
|
|
top: -20,
|
|
right: -20,
|
|
child: Container(
|
|
width: 80,
|
|
height: 80,
|
|
decoration: BoxDecoration(
|
|
shape: BoxShape.circle,
|
|
color: Colors.white.withOpacity(0.1),
|
|
),
|
|
),
|
|
),
|
|
// Middle Right Circle
|
|
Positioned(
|
|
top: 30,
|
|
right: 20,
|
|
child: Container(
|
|
width: 40,
|
|
height: 40,
|
|
decoration: BoxDecoration(
|
|
shape: BoxShape.circle,
|
|
color: Colors.white.withOpacity(0.08),
|
|
),
|
|
),
|
|
),
|
|
// Bottom Left Circle
|
|
Positioned(
|
|
bottom: -10,
|
|
left: -10,
|
|
child: Container(
|
|
width: 60,
|
|
height: 60,
|
|
decoration: BoxDecoration(
|
|
shape: BoxShape.circle,
|
|
color: Colors.white.withOpacity(0.06),
|
|
),
|
|
),
|
|
),
|
|
// Top Left Decorative Line
|
|
Positioned(
|
|
top: 10,
|
|
left: -5,
|
|
child: Transform.rotate(
|
|
angle: 0.5,
|
|
child: Container(
|
|
width: 30,
|
|
height: 2,
|
|
decoration: BoxDecoration(
|
|
color: Colors.white.withOpacity(0.15),
|
|
borderRadius: BorderRadius.circular(1),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
// Bottom Right Decorative Line
|
|
Positioned(
|
|
bottom: 15,
|
|
right: 10,
|
|
child: Transform.rotate(
|
|
angle: -0.5,
|
|
child: Container(
|
|
width: 25,
|
|
height: 2,
|
|
decoration: BoxDecoration(
|
|
color: Colors.white.withOpacity(0.15),
|
|
borderRadius: BorderRadius.circular(1),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
];
|
|
}
|
|
}
|