import 'dart:ui'; import 'package:flutter/material.dart'; import 'package:flutter/painting.dart'; class PopmenuShape extends ShapeBorder{ final double borderWidth; final BorderRadius borderRadius; const PopmenuShape({ this.borderWidth: 1.0,this.borderRadius: BorderRadius.zero,}) : assert(borderRadius != null); @override EdgeInsetsGeometry get dimensions { return new EdgeInsets.all(borderWidth); } @override ShapeBorder scale(double t) { return PopmenuShape( borderWidth: borderWidth * (t),borderRadius: borderRadius * (t),); } @override Path getInnerPath(Rect rect,{ TextDirection textDirection }) { return new Path() ..addRRect(borderRadius.resolve(textDirection).toRRect(rect).deflate( borderWidth)); } @override Path getOuterPath(Rect rect,{ TextDirection textDirection }) { return new Path() ..addRRect(borderRadius.resolve(textDirection).toRRect(rect)); } @override void paint(Canvas canvas,Rect rect,{ TextDirection textDirection }) { rect = rect.deflate(borderWidth / 2.0); Paint paint; final RRect borderRect = borderRadius.resolve(textDirection).toRRect(rect); paint = new Paint() ..color = Colors.white ..style = PaintingStyle.fill ..strokeWidth = borderWidth; // canvas.drawRRect(borderRect,paint); Path path = Path()..moveTo(borderRect.width - 10, borderRect.top +2 )..lineTo(borderRect.width - 20, borderRect.top - 10)..lineTo(borderRect.width - 30, borderRect.top+2); // canvas.drawShadow( // path, // Color(0xffdcdcdc), // 1, // false); canvas.drawPath(path, paint); } }