Skip to content

Instantly share code, notes, and snippets.

@Shreemanarjun
Created April 4, 2025 08:15
Show Gist options
  • Select an option

  • Save Shreemanarjun/b43a7e694831856612ffc3ad724993c6 to your computer and use it in GitHub Desktop.

Select an option

Save Shreemanarjun/b43a7e694831856612ffc3ad724993c6 to your computer and use it in GitHub Desktop.
CustomCardClippedRightBottom.dart
import 'package:flutter/material.dart';
class CardArc extends StatefulWidget {
const CardArc({super.key});
@override
State<CardArc> createState() => _CardArcState();
}
class _CardArcState extends State<CardArc> {
@override
Widget build(BuildContext context) {
return Container(
height: 300,
width: 300,
color: Colors.transparent,
child: GridPaper(
color: Colors.green,
divisions: 1,
child: CustomPaint(
painter: CardArcPainter(),
),
),
);
}
}
class CardArcPainter extends CustomPainter {
@override
void paint(Canvas canvas, Size size) {
final paint = Paint()
..color = Colors.red
..strokeWidth = 2
..style = PaintingStyle.stroke;
final x = size.width;
final y = size.height;
final portion = 0.7;
final path = Path()
..moveTo(0, 0)
..lineTo(x, 0)
..lineTo(x, y * portion);
canvas.drawPath(path, paint);
final path2 = Path()
..moveTo(0, 0)
..lineTo(0, y)
..lineTo(x * portion, y);
canvas.drawPath(path2, paint);
final paint2 = Paint()
..color = Colors.teal
..strokeWidth = 2
..style = PaintingStyle.stroke;
final firstControl = Offset(8, -y * (0.02));
final secondControl = Offset(6, -y * (0.10));
final path3 = Path()
..moveTo((x * portion), y)
..relativeQuadraticBezierTo(
firstControl.dx,
firstControl.dy,
secondControl.dx,
secondControl.dy,
);
canvas.drawPath(path3, paint2);
} // paint
@override
bool shouldRepaint(CustomPainter oldDelegate) {
return false;
}
@override
bool shouldRebuildSemantics(CustomPainter oldDelegate) {
return false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment