Files
CityCards_Customer_Flutter/lib/home/widgets/gradient_container_bg.dart
2025-11-11 14:18:35 +05:30

64 lines
1.6 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
class InwardCurvedContainer extends StatelessWidget {
final Widget child;
const InwardCurvedContainer({super.key, required this.child});
@override
Widget build(BuildContext context) {
return ClipPath(
clipper: InwardAndBottomConvexClipper(),
child: Container(
width: double.infinity,
height: 450.h,
decoration: const BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
Color(0xFFFFF5F5),
Color(0xFFFEF5F8),
Color(0xFFFFF5F5),
],
),
),
child: child,
),
);
}
}
class InwardAndBottomConvexClipper extends CustomClipper<Path> {
@override
Path getClip(Size size) {
Path path = Path();
// 👇 Start at top-left corner
path.moveTo(0, 0);
// ===== Top inward (concave) curve =====
path.quadraticBezierTo(
size.width / 2, 60, // Control point (lower Y = deeper dip)
size.width, 0, // End of top curve
);
// Right edge down
path.lineTo(size.width, size.height - 80);
// ===== Bottom outward (convex) curve =====
path.quadraticBezierTo(
size.width / 2, size.height + 20, // Control point (higher Y = bulge outward)
0, size.height - 80, // End of bottom curve
);
// Close back to start
path.close();
return path;
}
@override
bool shouldReclip(CustomClipper<Path> oldClipper) => false;
}