[英]how to draw this shape with flutter
I have a chat page, in the messages I need to draw a custom shape so how to draw this shape with flutter, ignore the purple color it's from screen shot我有一个聊天页面,在消息中我需要绘制一个自定义形状,所以如何用 flutter 绘制这个形状,忽略屏幕截图中的紫色
Container(
height: 0.1*MediaQuery.of(context).size.height,
color: Color(0xffFFC20F),
child: Text('some thing'),
)
I think this should help you.我认为这应该对你有所帮助。 You can modify the values according to your need.
您可以根据需要修改这些值。
class CustomClip extends CustomClipper<Path>{
@override
Path getClip(Size size){
Path path = Path();
path.moveTo(10,0);
path.lineTo(10,size.height/2 - 10);
path.lineTo(0,size.height/2);
path.lineTo(10,size.height/2 + 10);
path.lineTo(10,size.height);
path.lineTo(size.width,size.height);
path.lineTo(size.width,0);
path.close();
return path;
}
@override
bool shouldReclip(CustomClipper clipper){
return false;
}
}
Then you can use it in your code as然后你可以在你的代码中使用它
ClipPath(
clipper:CustomClip(),
child:Container(width:300,height:100,color:Colors.yellow),
);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.