flutter-贝塞尔曲线
Posted lxz-blogs
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了flutter-贝塞尔曲线相关的知识,希望对你有一定的参考价值。
import ‘package:flutter/material.dart‘; class HomePage extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( body: Column( children: <Widget>[ ClipPath( clipper: BottomClipper(),//路径 child: Container( color: Colors.deepOrange, height: 200, ), ) ], ), ); } } class BottomClipper extends CustomClipper<Path>{ @override Path getClip(Size size) { var path=Path(); path.lineTo(0, 0); path.lineTo(0, size.height-30); var firstControlPoint =Offset(size.width/2,size.height); var firstEndPoint = Offset(size.width,size.height-30); path.quadraticBezierTo(firstControlPoint.dx, firstControlPoint.dy, firstEndPoint.dx, firstEndPoint.dy); path.lineTo(size.width, size.height-30); path.lineTo(size.width, 0); return path; } @override bool shouldReclip(CustomClipper<Path> oldClipper) { return false; } }
双曲线
以上是关于flutter-贝塞尔曲线的主要内容,如果未能解决你的问题,请参考以下文章