Custom Triangle Shape
Complete Code For Custom Triangle Shape In Flutter
Main.dart
import 'package:flutter/material.dart'; void main() => runApp(MyApp()); class DrawTriangleShape extends CustomPainter { Paint painter; DrawTriangleShape() { painter = Paint() ..color = Colors.orange ..style = PaintingStyle.fill; } @override void paint(Canvas canvas, Size size) { var path = Path(); path.moveTo(size.width/2, 0); path.lineTo(0, size.height); path.lineTo(size.height, size.width); path.close(); canvas.drawPath(path, painter); } @override bool shouldRepaint(CustomPainter oldDelegate) { return false; } } class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, home: Scaffold( appBar: AppBar( backgroundColor: Colors.orange, title: Text('Custom Triangle Shape'), ), body: Center( child: CustomPaint( size: Size(180, 180), painter: DrawTriangleShape() ), ) ) ); } }