简体   繁体   English

在 dart flutter 中创建虚线圆边框

[英]create dotted circle border in dart flutter

Need to create dotted circle border.需要创建虚线圆边框。 Tried dotted border with radius property but still it not filling up like complete dotted circle with the text.尝试了带有半径属性的虚线边框,但它仍然没有像带有文本的完整虚线圆一样填充。 Please help to create dotted border like the image.请帮助创建像图像一样的虚线边框。 Thanks谢谢

Center(
            child: Text('Received'),
          ),
          SizedBox(height: 30),
          Center(
            child: Text('Shipped'),
          ),
          SizedBox(height: 30),
          Center(
            child: DottedBorder(
              dashPattern: const [8, 4],
              strokeWidth: 1,
              color: mainColor,
              radius: Radius.circular(20),
              child: SizedBox(),
            ),
          ),
          SizedBox(height: 30),
          Center(
            child: Text('Delivered'),
          )

设计

You can define the type by using BorderType.Circle to get a circular border您可以通过使用 BorderType.Circle 来定义类型以获得圆形边框

DottedBorder(
            borderType: BorderType.Circle,
            dashPattern: const [5, 10],
            child: Container(
              height: 50,
              width: 50,
              decoration: const BoxDecoration(shape: BoxShape.circle),
            )),

预习

You can use dotted_border package您可以使用 dotted_border package

    return DottedBorder(
    borderType: BorderType.RRect,
    radius: Radius.circular(12),
    padding: EdgeInsets.all(6),
    child: ClipRRect(
    borderRadius: BorderRadius.all(Radius.circular(12)),
    child: Container(
      height: 200,
      width: 120,
      color: Colors.amber,
       ),
     ),
    );

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM