![](/img/trans.png)
[英]How to implement custom dot shaped Tab indicator with custom color in flutter
[英]How to implement custom shape tab bar indicator in flutter
我发现了一个技巧,我要求设计师提供指标的 svg 文件。 然后我将 go 发送到fluttershapemaker并上传 svg 文件,它为我提供了自定义绘画和代码,天哪,天哪,它工作得很好。
这是由fluttershapemaker生成的自定义绘画代码
class TabPainter extends CustomPainter {
final Color? color;
TabPainter({this.color});
@override
void paint(Canvas canvas, Size size) {
Paint paint0Fill = Paint()..style = PaintingStyle.fill;
paint0Fill.color = const Color(0xff9AE9E1).withOpacity(1.0);
Path path_0 = Path();
path_0.moveTo(size.width * 0.08426966, size.height * 0.2744795);
path_0.cubicTo(
size.width * 0.08426966,
size.height * 0.03409159,
size.width * 0.02544281,
size.height * 0.001752948,
0,
size.height * 0.001753373);
path_0.lineTo(size.width * 0.9438202, size.height * 0.001753373);
path_0.cubicTo(
size.width * 0.9748483,
size.height * 0.001753373,
size.width,
size.height * 0.1035068,
size.width,
size.height * 0.2290250);
path_0.lineTo(size.width, size.height * 0.9790273);
path_0.cubicTo(
size.width,
size.height * 0.8863636,
size.width * 0.9765899,
size.height * 0.8653909,
size.width * 0.9662921,
size.height * 0.8653909);
path_0.lineTo(size.width * 0.1460674, size.height * 0.8653909);
path_0.cubicTo(
size.width * 0.1095506,
size.height * 0.8653909,
size.width * 0.08426966,
size.height * 0.7727273,
size.width * 0.08426966,
size.height * 0.5926636);
path_0.lineTo(size.width * 0.08426966, size.height * 0.2744795);
path_0.close();
paint0Fill.color = const Color(0xff9AE9E1).withOpacity(1.0);
canvas.drawPath(path_0, paint0Fill);
}
@override
bool shouldRepaint(CustomPainter oldDelegate) {
return true;
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.