gpt4 book ai didi

Flutter:如何制作自定义形状的文本字段

转载 作者:行者123 更新时间:2023-12-04 09:02:52 25 4
gpt4 key购买 nike

我对此很陌生。我如何设计以下内容:
a) 一个自定义文本框来输入带有图标的
enter image description here
PS:使用 InputBorder 时添加问题:
enter image description here

最佳答案

最后根据建议使用以下内容:

class DMTextBoxOutlineBorder extends OutlineInputBorder {

@override
void paint(
Canvas canvas,
Rect rect, {
double gapStart,
double gapExtent = 0.0,
double gapPercentage = 0.0,
TextDirection textDirection,
}) {

var paint = Paint();
paint.color = Colors.black;
paint.strokeWidth = 1.0;

var startXPos = rect.bottomLeft.dx;
var startYPos = rect.bottomLeft.dy;
var height = rect.bottomLeft.dy - rect.topLeft.dy;
var width = (rect.bottomRight.dx - rect.bottomLeft.dx);

var textBox = Path();
textBox.moveTo(startXPos, startYPos);
textBox.lineTo(startXPos + width, startYPos);
......rest of the code to complete the required shape

canvas.drawPath(textBox, paint);
}

bool shouldRepaint(CustomPainter oldDelegate) {
return true;
}
}

关于Flutter:如何制作自定义形状的文本字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63526152/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com