feat: voucher card
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class VoucherClipper extends CustomClipper<Path> {
|
||||
@override
|
||||
Path getClip(Size size) {
|
||||
final path = Path();
|
||||
double notchRadius = 10.0;
|
||||
double notchPosition = size.height * 0.6; // Position of notch
|
||||
|
||||
// Start from top-left
|
||||
path.moveTo(0, 12);
|
||||
|
||||
// Top edge with rounded corners
|
||||
path.quadraticBezierTo(0, 0, 12, 0);
|
||||
path.lineTo(size.width - 12, 0);
|
||||
path.quadraticBezierTo(size.width, 0, size.width, 12);
|
||||
|
||||
// Right edge until notch
|
||||
path.lineTo(size.width, notchPosition - notchRadius);
|
||||
|
||||
// Right notch (semicircle going inward)
|
||||
path.arcToPoint(
|
||||
Offset(size.width, notchPosition + notchRadius),
|
||||
radius: Radius.circular(notchRadius),
|
||||
clockwise: false,
|
||||
);
|
||||
|
||||
// Continue right edge
|
||||
path.lineTo(size.width, size.height - 12);
|
||||
|
||||
// Bottom edge
|
||||
path.quadraticBezierTo(
|
||||
size.width,
|
||||
size.height,
|
||||
size.width - 12,
|
||||
size.height,
|
||||
);
|
||||
path.lineTo(12, size.height);
|
||||
path.quadraticBezierTo(0, size.height, 0, size.height - 12);
|
||||
|
||||
// Left edge until notch
|
||||
path.lineTo(0, notchPosition + notchRadius);
|
||||
|
||||
// Left notch (semicircle going inward)
|
||||
path.arcToPoint(
|
||||
Offset(0, notchPosition - notchRadius),
|
||||
radius: Radius.circular(notchRadius),
|
||||
clockwise: false,
|
||||
);
|
||||
|
||||
// Close path
|
||||
path.close();
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
@override
|
||||
bool shouldReclip(covariant CustomClipper<Path> oldClipper) => false;
|
||||
}
|
||||
Reference in New Issue
Block a user