Orientação gerada a partir de informações públicas. Apenas para referência.
Proste Bezier Curve é um pacote leve para Flutter que simplifica a criação e utilização de curvas de Bezier padrão. Reduz o código boilerplate e a complexidade, permitindo que desenvolvedores criem caminhos personalizados ou recortem widgets com formas suaves e curvas. Ideal para elementos da interface que exigem contornos elegantes e fluidos, ele é compatível com todas as principais plataformas, incluindo Android, iOS, Web, macOS, Windows e Linux. O pacote é especialmente útil para projetar interfaces modernas com esforço mínimo.
Casos de uso
Criando bordas de interface com curvas
Recortando widgets com formas personalizadas
Designando transições de caminho animadas
Construindo componentes de desenho interativos
Melhorando o apelo visual com curvas suaves
Principais recursos
API simples para criação de curvas Bézier
Suporta recorte de widget com caminhos de Bezier
Compatibilidade multiplataforma
Código mínimo necessário
Personalização flexível de caminho
Indicado para
Designers de UI procurando curvas elegantes
Desenvolvedores criando formas personalizadas
Aplicativos que precisam de caminhos animados suaves
Iniciantes do Flutter explorando desenho de caminhos
Projetos focados em estéticas limpas e modernas
Considerações
Limitado a curvas de Bezier padrão (não B-splines)
Sem suporte embutido para animação
Requer manipulação manual de atualizações de caminho
Não ideal para designs complexos baseados em splines
Mais adequado para caminhos estáticos ou simples dinâmicos
README original
Snapshot do README original do repositório-fonte vinculado. Consulte o repositório para o conteúdo mais recente.
The control points of Bezier curve are obtained through data calculation, and then the points are drawn into curves through the drawing function of flutter.
The difference between using package and drawing your own path
The common method of tracing points according to the position of elements will leave a gap. Only after the control points are calculated can the element information be completely filled. For example, in the following picture, the coordinates of the points used are the same, but the styles cut out are different. The function I want to provide is to restore the design style as much as possible. And after using the package, you only need to confirm the coordinates of each point, without other complex calculations, and the code is more concise.
BezierCurveDots Coordinates of Bezier curve control points
parameter
type
default
describe
x1
double
The X-coordinate of the first point
y1
double
The Y-coordinate of the first point
x2
double
The X-coordinate of the second point
y2
double
The Y-coordinate of the second point
Static function of ProsteBezierCurve
BezierCurveDots calcCurveDots(BezierCurveSection param) Obtain the coordinates of the control points after calculation, and draw the path after obtaining the control points, such as drawing curves with multiple edges or combining the curves with other drawing rules
ThirdOrderBezierCurveSection Fragment for drawing third order Bezier curve
parameter
type
default
describe
p1
Offset
The coordinates of the first point
p2
Offset
The coordinates of the second point
p3
Offset
The coordinates of the third point
p4
Offset
The coordinates of the fourth point
smooth
double
.5
The greater the value of smoothness 0 ~ 1, the straighter the value is, the smaller the value is, and the larger the arc is. When the drawing distance is short and saw tooth appears, try to increase this value
The position coordinates of the four points can refer to the figure below. The starting and ending points are P1 and P4 respectively.Picture sample URL。You can understand that four points form a rectangle, and the four coordinates are the positions of the four points. The curve will be drawn in the rectangle.
We can also draw a single arc graph through the third-order Bessel function, need P1 and P4 are on the same side,But that brings up the problem that was stated at the beginning,The arc does not cling to the bottom.
ThirdOrderBezierCurveDots Coordinates of third order Bezier curve control points
parameter
type
default
describe
x1
double
The X-coordinate of the first point
y1
double
The Y-coordinate of the first point
x2
double
The X-coordinate of the second point
y2
double
The Y-coordinate of the second point
x3
double
The X-coordinate of the third point
y3
double
The Y-coordinate of the third point
Static function of ProsteThirdOrderBezierCurve
ThirdOrderBezierCurveDots calcCurveDots(ThirdOrderBezierCurveSection param) Obtain the coordinates of the control points after calculation, and draw the path after obtaining the control points, such as drawing curves with multiple edges or combining the curves with other drawing rules