如何在颤振中创建垂直虚线?

时间:2021-05-17 10:55:01

标签: flutter dart

如果您可以为我的问题编写代码,我不想使用任何库 请帮忙。 谢谢。

1 个答案:

答案 0 :(得分:0)

我找到了一个解决方案:

$( "#sortable" ).sortable({
  update: function( event, ui ) {
    var item = ui.item;
    var target_prev = ui.item.prev();
    var target_next = ui.item.next();
    console.log('item', item);
    console.log('target_prev', target_prev);
    console.log('target_next', target_next);
  }
});

用法:

class DashedLineVerticalPainter extends CustomPainter {
  @override
  void paint(Canvas canvas, Size size) {
    double dashHeight = 5, dashSpace = 3, startY = 0;
    final paint = Paint()
      ..color = Colors.black
      ..strokeWidth = 1;
    while (startY < size.height) {
      canvas.drawLine(Offset(0, startY), Offset(0, startY + dashHeight), paint);
      startY += dashHeight + dashSpace;
    }
  }

  @override
  bool shouldRepaint(CustomPainter oldDelegate) => false;
}