You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
80 lines
1.9 KiB
Dart
80 lines
1.9 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
class EasyLine extends StatelessWidget {
|
|
final double length;
|
|
final double width;
|
|
final Color color;
|
|
final double thickness;
|
|
final double spacing;
|
|
final LineType lineType;
|
|
final Axis axis;
|
|
|
|
const EasyLine({
|
|
key,
|
|
this.length = 50.0,
|
|
this.color = Colors.grey,
|
|
this.thickness = 3,
|
|
this.spacing = 3.0,
|
|
this.width = 2.0,
|
|
this.lineType = LineType.normal,
|
|
this.axis = Axis.horizontal,
|
|
}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
width: axis == Axis.horizontal
|
|
? length
|
|
: thickness,
|
|
height: axis == Axis.vertical
|
|
? length : thickness,
|
|
decoration: BoxDecoration(
|
|
color: color,
|
|
borderRadius: BorderRadius.circular(100),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
|
|
enum LineType {
|
|
normal,
|
|
dotted,
|
|
dashed,
|
|
}
|
|
class LineStyle {
|
|
final Color defaultLineColor;
|
|
final Color unreachedLineColor;
|
|
final Color activeLineColor;
|
|
final Color finishedLineColor;
|
|
final double lineLength;
|
|
final double lineThickness;
|
|
final double lineWidth;
|
|
final double lineSpace;
|
|
final LineType lineType;
|
|
final LineType unreachedLineType;
|
|
final Color progressColor;
|
|
final double progress;
|
|
const LineStyle({
|
|
Key key,
|
|
this.lineType = LineType.dotted,
|
|
this.defaultLineColor,
|
|
this.unreachedLineColor,
|
|
this.activeLineColor,
|
|
this.finishedLineColor,
|
|
this.lineLength = 40,
|
|
this.lineWidth = 4,
|
|
this.lineThickness = 1,
|
|
this.lineSpace = 5,
|
|
this.unreachedLineType,
|
|
this.progressColor,
|
|
this.progress,
|
|
}) : assert(
|
|
progressColor == null || progress != null,
|
|
'progress should be defined to use progressColor',
|
|
),
|
|
assert(
|
|
progress == null || (progress >= 0 && progress <= 1),
|
|
'progress value should be between 0 and 1',
|
|
);
|
|
} |