feat(delete):删除里面文件夹

This commit is contained in:
2025-10-23 10:47:53 +08:00
parent 35d26643ba
commit 55ab438c11
75 changed files with 2424 additions and 41 deletions

86
lib/lineline/dash_line.dart Executable file
View File

@@ -0,0 +1,86 @@
import 'package:flutter/material.dart';
///@Desc 虚线
class DashLine extends StatelessWidget {
final Color? color; // 虚线颜色
final Axis direction; // 虚线方向
final double? dottedLength; //虚线长度
const DashLine({
Key? key,
this.color,
this.direction = Axis.horizontal,
this.dottedLength,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return CustomPaint(
painter: DashedLinePainter(
color: color ?? const Color(0xff36C2FD),
direction: direction,
dottedLength: dottedLength,
),
);
}
}
class DashedLinePainter extends CustomPainter {
final Color color;
final double width;
final Axis direction; //方向
final double? dottedLength; //虚线长度
DashedLinePainter({
this.width = 1,
this.color = Colors.black,
this.direction = Axis.horizontal,
this.dottedLength,
});
@override
void paint(Canvas canvas, Size size) {
final Paint paint = Paint()
..color = color
..strokeWidth = width
..style = PaintingStyle.stroke
..strokeCap = StrokeCap.round
..isAntiAlias = true;
Path dottedPath = _createDashedPath(
Path()
..moveTo(0, 0)
..lineTo(
direction == Axis.horizontal ? size.width : 0,
direction == Axis.horizontal ? 0 : size.height,
),
length: dottedLength,
);
canvas.drawPath(dottedPath, paint);
}
Path _createDashedPath(Path path,{double? length}) {
Path targetPath = Path();
double dottedLength = length ?? 10;
double dottedGap = length ?? 10;
for (var metric in path.computeMetrics()) {
double distance = 0;
bool isDrawDotted = true;
while (distance < metric.length) {
if (isDrawDotted) {
targetPath.addPath(
metric.extractPath(distance, distance + dottedLength),
Offset.zero,
);
distance += dottedLength;
} else {
distance += dottedGap;
}
isDrawDotted = !isDrawDotted;
}
}
return targetPath;
}
@override
bool shouldRepaint(DashedLinePainter oldDelegate) => false;
}

61
lib/lineline/time_line.dart Executable file
View File

@@ -0,0 +1,61 @@
import 'package:flutter/material.dart';
import 'dash_line.dart';
///@Desc 时间线
class TimeLine extends StatelessWidget {
final bool isLast;
final Widget child;
const TimeLine({
Key? key,
required this.isLast,
required this.child,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return IntrinsicHeight(
child: Row(
children: [
_buildDot(),
const SizedBox(width: 16),
Expanded(child: child),
],
),
);
}
Widget _buildDot() {
return Column(
children: [
Container(
width: 24,
height: 24,
decoration: const BoxDecoration(
shape: BoxShape.circle,
color: Color(0xff36C2FD),
),
alignment: Alignment.center,
child: Container(
width: 12,
height: 12,
decoration: const BoxDecoration(
shape: BoxShape.circle,
color: Colors.white,
),
),
),
if (isLast)
const SizedBox.shrink()
else
const Expanded(
child: DashLine(
color: Color(0xff36C2FD),
direction: Axis.vertical,
),
)
],
);
}
}