Skip to content

Commit

Permalink
fix dot line and pass strokeWidth
Browse files Browse the repository at this point in the history
  • Loading branch information
taniyarn committed Apr 3, 2023
1 parent 436b1e9 commit 974ee64
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions lib/src/line_chart/line_chart_bar_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,12 @@ class LineChartBarData extends Equatable {
/// The dash array of the line.
abstract class DashArray {
/// The dotted line.
static const dotted = [4.0, 4.0];
static List<double> dotted([double strokeWidth = 2.0]) =>
[0.0, 2.0 * strokeWidth];

/// The dashed line.
static const dashed = [6.0, 4.0];
static List<double> dashed([double strokeWidth = 2.0]) =>
[3.0 * strokeWidth, 2.0 * strokeWidth];
}

/// The data point type.
Expand Down
2 changes: 1 addition & 1 deletion lib/src/utils/dash.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Path calculateDashPath(
Path path, {
required CircularIntervalList<double> dashArray,
}) {
assert(dashArray._values.every((value) => value > 0));
assert(dashArray._values.every((value) => value >= 0));
final dashPath = Path();
for (final metric in path.computeMetrics()) {
var distance = 0.0;
Expand Down

0 comments on commit 974ee64

Please sign in to comment.