Skip to content

Commit 573b643

Browse files
committed
Add strokeCap param for Circular progress indicator.
1 parent f1e7c06 commit 573b643

9 files changed

+52
-29
lines changed

lib/src/api/mixins.dart

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ abstract class DefaultShapeNode extends SceneNode
4949
double strokeWeight = 0,
5050
double? strokeMiterLimit,
5151
StrokeAlignC strokeAlign = StrokeAlignC.inside,
52-
StrokeCapEnum strokeCap = StrokeCapEnum.none,
52+
StrokeCapEnum strokeCap = StrokeCapEnum.square,
5353
List<double>? dashPattern,
5454
StrokeSide strokeSide = StrokeSide.all,
5555
}) {
@@ -446,9 +446,6 @@ enum StrokeAlignC {
446446
/// Styles to use for line endings on a stroke.
447447
/// Corresponds to [StrokeCap] in Flutter.
448448
enum StrokeCapEnum {
449-
/// Unspecified.
450-
none,
451-
452449
/// Begin and end contours with a semi-circle extension.
453450
///
454451
/// ![A round cap adds a rounded end to the line segment that protrudes
@@ -459,6 +456,15 @@ enum StrokeCapEnum {
459456
/// is the same color as the line.
460457
round,
461458

459+
/// Begin and end contours with a flat edge and no extension.
460+
///
461+
/// ![A butt cap ends line segments with a square end that stops at the end of
462+
/// the line segment.](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/butt_cap.png)
463+
///
464+
/// Compare to the [square] cap, which has the same shape, but extends past
465+
/// the end of the line by half a stroke width.
466+
butt,
467+
462468
/// Begin and end contours with a half square extension. This is similar to
463469
/// extending each contour by half the stroke width/thickness.
464470
///
@@ -555,6 +561,7 @@ mixin GeometryMixin on BaseNode {
555561
late StrokeAlignC strokeAlign;
556562

557563
/// Type of line cap to use for the stroke.
564+
@JsonKey(unknownEnumValue: StrokeCapEnum.square)
558565
late StrokeCapEnum strokeCap;
559566

560567
/// The pattern of dashes and gaps to apply to the stroke in case of dashed

lib/src/api/nodes/auto_placeholder_node.g.dart

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/src/api/nodes/canvas_node.g.dart

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/src/api/nodes/frame_node.g.dart

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/src/api/nodes/freeform_placeholder_node.g.dart

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/src/api/nodes/loading_indicator_node.dart

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,12 +150,15 @@ class MaterialLoadingIndicatorProperties extends LoadingIndicatorProperties {
150150
/// Progress of the loading indicator.
151151
double? value;
152152

153+
StrokeCapEnum strokeCap;
154+
153155
/// Creates a new [MaterialLoadingIndicatorProperties].
154156
MaterialLoadingIndicatorProperties({
155157
required this.color,
156158
this.backgroundColor = ColorRGBA.transparent,
157159
this.strokeWidth = 4,
158160
this.value,
161+
this.strokeCap = StrokeCapEnum.square,
159162
});
160163

161164
/// Duplicates this [MaterialLoadingIndicatorProperties] with given data
@@ -165,17 +168,20 @@ class MaterialLoadingIndicatorProperties extends LoadingIndicatorProperties {
165168
ColorRGBA? backgroundColor,
166169
double? strokeWidth,
167170
double? value,
171+
StrokeCapEnum? strokeCap,
168172
}) {
169173
return MaterialLoadingIndicatorProperties(
170174
color: color ?? this.color,
171175
strokeWidth: strokeWidth ?? this.strokeWidth,
172176
value: value ?? this.value,
173177
backgroundColor: backgroundColor ?? this.backgroundColor,
178+
strokeCap: strokeCap ?? this.strokeCap,
174179
);
175180
}
176181

177182
@override
178-
List<Object?> get props => [type, color, strokeWidth, value, backgroundColor];
183+
List<Object?> get props =>
184+
[type, color, strokeWidth, value, backgroundColor, strokeCap];
179185

180186
@override
181187
Map toJson() => _$MaterialLoadingIndicatorPropertiesToJson(this);

lib/src/api/nodes/loading_indicator_node.g.dart

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/src/api/nodes/rectangle_node.g.dart

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/src/api/nodes/row_column_node.g.dart

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)