getCoreUtilsTopDiagonalClipperTemplate function

String getCoreUtilsTopDiagonalClipperTemplate(
  1. String projectName
)

Implementation

String getCoreUtilsTopDiagonalClipperTemplate(String projectName) {
  return '''
import 'package:flutter/material.dart';

class TopDiagonalClipper extends CustomClipper<Path> {
  @override
  Path getClip(Size size) {
    final path = Path();

    double leftRadius = 30;
    double rightRadius = 60;

    /// Start bottom left
    path.moveTo(0, size.height);

    /// Left side up
    path.lineTo(0, size.height * 0.35);

    /// Top left rounded corner
    path.quadraticBezierTo(
      0,
      size.height * 0.25,
      leftRadius,
      size.height * 0.25,
    );

    /// Diagonal top line
    path.lineTo(size.width - rightRadius - 40, 0);

    /// Top right curve
    path.quadraticBezierTo(size.width, 0, size.width, rightRadius);

    /// Right side down
    path.lineTo(size.width, size.height);

    /// Bottom line
    path.lineTo(0, size.height);

    path.close();

    return path;
  }

  @override
  bool shouldReclip(CustomClipper<Path> oldClipper) => false;
}
''';
}