From 2294a0b147f11b785d303f35e854dd0462ff995e Mon Sep 17 00:00:00 2001 From: Harry Sild <46851868+Kypsis@users.noreply.github.com> Date: Mon, 5 Feb 2024 12:36:15 +0200 Subject: [PATCH 1/2] fix: [MDS-984] Update LinearProgress according to design (#342) --- .../storybook/stories/linear_progress.dart | 22 ++- .../linear_progress_colors.dart | 10 +- .../linear_progress_size_properties.dart | 26 ++- .../linear_progress_sizes.dart | 15 ++ .../linear_progress_theme.dart | 1 + .../progress_pin/progress_pin_properties.dart | 24 ++- .../progress_pin/progress_pin_theme.dart | 9 +- .../linear_progress_indicator.dart | 12 +- .../linear_progress_indicator_painter.dart | 25 +-- lib/src/widgets/loaders/linear_loader.dart | 3 +- lib/src/widgets/progress/linear_progress.dart | 155 +++++++++++++++--- lib/src/widgets/progress_pin/pin_style.dart | 50 +++++- .../widgets/progress_pin/progress_pin.dart | 37 +++-- .../progress_pin/progress_pin_painter.dart | 43 ++--- 14 files changed, 341 insertions(+), 91 deletions(-) diff --git a/example/lib/src/storybook/stories/linear_progress.dart b/example/lib/src/storybook/stories/linear_progress.dart index 943f3282..b92a77fb 100644 --- a/example/lib/src/storybook/stories/linear_progress.dart +++ b/example/lib/src/storybook/stories/linear_progress.dart @@ -98,6 +98,16 @@ class LinearProgressStory extends StatelessWidget { description: "Show pin for LinearProgress", ); + final showMinLabelKnob = context.knobs.boolean( + label: "showMinLabel", + description: "Show minLabel for LinearProgress", + ); + + final showMaxLabelKnob = context.knobs.boolean( + label: "showMaxLabel", + description: "Show maxLabel for LinearProgress", + ); + final showPinShadowKnob = context.knobs.boolean( label: "showPinShadow", description: "Show pin shadow for LinearProgress", @@ -108,6 +118,13 @@ class LinearProgressStory extends StatelessWidget { child: Padding( padding: const EdgeInsets.symmetric(vertical: 64, horizontal: 16), child: MoonLinearProgress( + linearProgressSize: progressSizeKnob, + value: linearProgressValueKnob, + color: color, + backgroundColor: backgroundColor, + borderRadius: borderRadiusKnob != null ? BorderRadius.circular(borderRadiusKnob.toDouble()) : null, + showMinLabel: showMinLabelKnob, + showMaxLabel: showMaxLabelKnob, showPin: showPinKnob, pinStyle: PinStyle( pinColor: pinColor, @@ -115,11 +132,6 @@ class LinearProgressStory extends StatelessWidget { thumbColor: thumbColor, showShadow: showPinShadowKnob, ), - value: linearProgressValueKnob, - linearProgressSize: progressSizeKnob, - color: color, - backgroundColor: backgroundColor, - borderRadius: borderRadiusKnob != null ? BorderRadius.circular(borderRadiusKnob.toDouble()) : null, ), ), ); diff --git a/lib/src/theme/progress/linear_progress/linear_progress_colors.dart b/lib/src/theme/progress/linear_progress/linear_progress_colors.dart index 359808a6..0ce53061 100644 --- a/lib/src/theme/progress/linear_progress/linear_progress_colors.dart +++ b/lib/src/theme/progress/linear_progress/linear_progress_colors.dart @@ -11,19 +11,25 @@ class MoonLinearProgressColors extends ThemeExtension /// Linear progress background color. final Color backgroundColor; + /// Linear progress minWidget and maxWidget text color. + final Color textColor; + const MoonLinearProgressColors({ required this.color, required this.backgroundColor, + required this.textColor, }); @override MoonLinearProgressColors copyWith({ Color? color, Color? backgroundColor, + Color? textColor, }) { return MoonLinearProgressColors( color: color ?? this.color, backgroundColor: backgroundColor ?? this.backgroundColor, + textColor: textColor ?? this.textColor, ); } @@ -34,6 +40,7 @@ class MoonLinearProgressColors extends ThemeExtension return MoonLinearProgressColors( color: colorPremulLerp(color, other.color, t)!, backgroundColor: colorPremulLerp(backgroundColor, other.backgroundColor, t)!, + textColor: colorPremulLerp(textColor, other.textColor, t)!, ); } @@ -43,6 +50,7 @@ class MoonLinearProgressColors extends ThemeExtension properties ..add(DiagnosticsProperty("type", "MoonLinearProgressColors")) ..add(ColorProperty("color", color)) - ..add(ColorProperty("backgroundColor", backgroundColor)); + ..add(ColorProperty("backgroundColor", backgroundColor)) + ..add(ColorProperty("textColor", textColor)); } } diff --git a/lib/src/theme/progress/linear_progress/linear_progress_size_properties.dart b/lib/src/theme/progress/linear_progress/linear_progress_size_properties.dart index 7d39c668..8991ee3c 100644 --- a/lib/src/theme/progress/linear_progress/linear_progress_size_properties.dart +++ b/lib/src/theme/progress/linear_progress/linear_progress_size_properties.dart @@ -12,19 +12,37 @@ class MoonLinearProgressSizeProperties extends ThemeExtension("borderRadius", borderRadius)) - ..add(DoubleProperty("progressHeight", progressHeight)); + ..add(DoubleProperty("progressHeight", progressHeight)) + ..add(DoubleProperty("thumbSizeValue", thumbSizeValue)) + ..add(DoubleProperty("verticalGap", verticalGap)) + ..add(DiagnosticsProperty("textStyle", textStyle)); } } diff --git a/lib/src/theme/progress/linear_progress/linear_progress_sizes.dart b/lib/src/theme/progress/linear_progress/linear_progress_sizes.dart index 69957e99..dc88fb31 100644 --- a/lib/src/theme/progress/linear_progress/linear_progress_sizes.dart +++ b/lib/src/theme/progress/linear_progress/linear_progress_sizes.dart @@ -35,26 +35,41 @@ class MoonLinearProgressSizes extends ThemeExtension wi MoonLinearProgressSizeProperties( borderRadius: tokens.borders.surfaceXs, progressHeight: tokens.sizes.x6s, + thumbSizeValue: tokens.sizes.x3s, + verticalGap: tokens.sizes.x4s, + textStyle: tokens.typography.caption.text10, ), x5s = x5s ?? MoonLinearProgressSizeProperties( borderRadius: tokens.borders.surfaceXs, progressHeight: tokens.sizes.x5s, + thumbSizeValue: tokens.sizes.x3s, + verticalGap: tokens.sizes.x4s, + textStyle: tokens.typography.caption.text10, ), x4s = x4s ?? MoonLinearProgressSizeProperties( borderRadius: tokens.borders.surfaceSm, progressHeight: tokens.sizes.x4s, + thumbSizeValue: tokens.sizes.x3s, + verticalGap: 6, + textStyle: tokens.typography.caption.text10, ), x3s = x3s ?? MoonLinearProgressSizeProperties( borderRadius: tokens.borders.surfaceMd, progressHeight: tokens.sizes.x3s, + thumbSizeValue: tokens.sizes.x2s, + verticalGap: 6, + textStyle: tokens.typography.caption.text10, ), x2s = x2s ?? MoonLinearProgressSizeProperties( borderRadius: tokens.borders.surfaceLg, progressHeight: tokens.sizes.x2s, + thumbSizeValue: tokens.sizes.x2s, + verticalGap: tokens.sizes.x5s, + textStyle: tokens.typography.caption.text10, ); @override diff --git a/lib/src/theme/progress/linear_progress/linear_progress_theme.dart b/lib/src/theme/progress/linear_progress/linear_progress_theme.dart index f37ea160..568b9f23 100644 --- a/lib/src/theme/progress/linear_progress/linear_progress_theme.dart +++ b/lib/src/theme/progress/linear_progress/linear_progress_theme.dart @@ -24,6 +24,7 @@ class MoonLinearProgressTheme extends ThemeExtension wi MoonLinearProgressColors( color: tokens.colors.piccolo, backgroundColor: tokens.colors.beerus, + textColor: tokens.colors.textPrimary, ), sizes = sizes ?? MoonLinearProgressSizes(tokens: tokens); diff --git a/lib/src/theme/progress_pin/progress_pin_properties.dart b/lib/src/theme/progress_pin/progress_pin_properties.dart index 0ebacba0..118763ed 100644 --- a/lib/src/theme/progress_pin/progress_pin_properties.dart +++ b/lib/src/theme/progress_pin/progress_pin_properties.dart @@ -8,6 +8,12 @@ class MoonProgressPinProperties extends ThemeExtension("textStyle", textStyle)); } } diff --git a/lib/src/theme/progress_pin/progress_pin_theme.dart b/lib/src/theme/progress_pin/progress_pin_theme.dart index 27d4d445..635cd570 100644 --- a/lib/src/theme/progress_pin/progress_pin_theme.dart +++ b/lib/src/theme/progress_pin/progress_pin_theme.dart @@ -30,12 +30,13 @@ class MoonProgressPinTheme extends ThemeExtension with Dia ), properties = properties ?? MoonProgressPinProperties( - pinDistance: 6, + arrowHeight: 6, + arrowWidth: tokens.sizes.x4s, + pinDistance: tokens.sizes.x5s, pinWidth: 36, - pinBorderWidth: 2, - thumbWidthMultiplier: 1.5, + pinBorderWidth: tokens.sizes.x6s, shadowElevation: 6, - textStyle: tokens.typography.caption.text10.copyWith(letterSpacing: 0.5), + textStyle: tokens.typography.caption.text10, ); @override diff --git a/lib/src/widgets/common/progress_indicators/linear_progress_indicator.dart b/lib/src/widgets/common/progress_indicators/linear_progress_indicator.dart index 7d3bddad..2b1e2e9c 100644 --- a/lib/src/widgets/common/progress_indicators/linear_progress_indicator.dart +++ b/lib/src/widgets/common/progress_indicators/linear_progress_indicator.dart @@ -5,7 +5,8 @@ import 'package:moon_design/src/widgets/common/progress_indicators/painters/line class MoonLinearProgressIndicator extends MoonBaseProgressIndicator { /// The border radius of the linear progress indicator. - final BorderRadiusGeometry borderRadius; + final BorderRadiusGeometry containerRadius; + final BorderRadiusGeometry progressRadius; /// The minimum height of the linear progress indicator. final double minHeight; @@ -20,7 +21,8 @@ class MoonLinearProgressIndicator extends MoonBaseProgressIndicator { super.semanticsLabel, super.semanticsValue, this.minHeight = 4, - this.borderRadius = BorderRadius.zero, + this.containerRadius = BorderRadius.zero, + this.progressRadius = BorderRadius.zero, }) : assert(minHeight > 0); /// Color of the track being filled by the linear indicator. @@ -65,7 +67,8 @@ class _MoonLinearProgressIndicatorState extends State BorderRadiusDirectional.only( + topStart: effectiveBorderRadius.topStart, + bottomStart: effectiveBorderRadius.bottomStart, + ), + BorderRadius() when showPin == true => BorderRadiusDirectional.only( + topStart: effectiveBorderRadius.topLeft, + bottomStart: effectiveBorderRadius.bottomLeft, + ), + _ => effectiveBorderRadius, + }; + final Color effectiveColor = color ?? context.moonTheme?.linearProgressTheme.colors.color ?? MoonColors.light.piccolo; final Color effectiveBackgroundColor = backgroundColor ?? context.moonTheme?.linearProgressTheme.colors.backgroundColor ?? MoonColors.light.beerus; + final Color effectiveTextColor = + textColor ?? context.moonTheme?.linearProgressTheme.colors.textColor ?? MoonColors.light.textPrimary; + final double effectiveHeight = height ?? effectiveProgressSize.progressHeight; + final double effectiveTopGap = verticalGap ?? effectiveProgressSize.verticalGap; + + final double effectiveThumbSizeValue = + // ignore: deprecated_member_use_from_same_package + (pinStyle?.thumbSizeValue ?? pinStyle?.thumbWidth) ?? effectiveProgressSize.thumbSizeValue; + + final double effectivePinWidth = + pinStyle?.pinWidth ?? context.moonTheme?.progressPinTheme.properties.pinWidth ?? 36; + + final double effectivePinDistance = + pinStyle?.pinDistance ?? context.moonTheme?.progressPinTheme.properties.pinDistance ?? MoonSizes.sizes.x5s; + + final double effectivePinArrowHeight = + pinStyle?.arrowHeight ?? context.moonTheme?.progressPinTheme.properties.arrowHeight ?? 6; + + final TextStyle effectiveTextStyle = effectiveProgressSize.textStyle; + + final double resolvedPaddingValue = + effectiveThumbSizeValue - effectiveHeight > 0 ? effectiveThumbSizeValue / 2 - effectiveHeight / 2 : 0; + + final double heightWithPin = + effectivePinWidth + effectivePinArrowHeight + effectivePinDistance + effectiveThumbSizeValue; + + Widget child = MoonLinearProgressIndicator( + value: value, + color: effectiveColor, + backgroundColor: effectiveBackgroundColor, + containerRadius: effectiveBorderRadius, + progressRadius: showPin ? progressRadius : effectiveBorderRadius, + minHeight: effectiveHeight, + ); + + if (showPin) { + child = MoonProgressPin( + progressValue: value, + pinText: '${(value * 100).round()}%', + pinStyle: pinStyle?.copyWith(thumbSizeValue: effectiveThumbSizeValue), + child: child, + ); + } + + if (showMinLabel || showMaxLabel) { + child = Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + if (showMinLabel) + Expanded( + child: DefaultTextStyle( + style: effectiveTextStyle.copyWith(color: effectiveTextColor), + child: Align( + alignment: AlignmentDirectional.centerStart, + child: minLabel ?? const Text("0%"), + ), + ), + ), + if (showMaxLabel) + Expanded( + child: DefaultTextStyle( + style: effectiveTextStyle.copyWith(color: effectiveTextColor), + child: Align( + alignment: AlignmentDirectional.centerEnd, + child: maxLabel ?? const Text("100%"), + ), + ), + ), + ], + ), + SizedBox(height: effectiveTopGap), + child, + ], + ); + } + + if (showPin && pinAffectsHeight) { + child = Container( + height: heightWithPin, + padding: EdgeInsets.only(bottom: resolvedPaddingValue), + alignment: Alignment.bottomCenter, + child: child, + ); + } + return Semantics( label: semanticLabel, value: "${value * 100}%", - child: showPin - ? MoonProgressPin( - progressValue: value, - progressLabel: '${(value * 100).round()}%', - pinStyle: pinStyle, - child: MoonLinearProgressIndicator( - value: value, - color: effectiveColor, - backgroundColor: effectiveBackgroundColor, - borderRadius: effectiveBorderRadius, - minHeight: effectiveHeight, - ), - ) - : MoonLinearProgressIndicator( - value: value, - color: effectiveColor, - backgroundColor: effectiveBackgroundColor, - borderRadius: effectiveBorderRadius, - minHeight: effectiveHeight, - ), + child: child, ); } } diff --git a/lib/src/widgets/progress_pin/pin_style.dart b/lib/src/widgets/progress_pin/pin_style.dart index 11c3c8f8..1a64d04d 100644 --- a/lib/src/widgets/progress_pin/pin_style.dart +++ b/lib/src/widgets/progress_pin/pin_style.dart @@ -16,9 +16,19 @@ class PinStyle { /// The color of the pin shadow. final Color? shadowColor; + /// The height of the pin arrow. + final double? arrowHeight; + + /// The width of the pin arrow. + final double? arrowWidth; + /// The width of the thumb. + @Deprecated("Use thumbSizeValue instead") final double? thumbWidth; + /// The size value of the thumb. + final double? thumbSizeValue; + /// The width of the pin. final double? pinWidth; @@ -40,11 +50,49 @@ class PinStyle { this.pinBorderColor, this.thumbColor, this.shadowColor, - this.thumbWidth, + this.arrowHeight, + this.arrowWidth, + @Deprecated("Use thumbSizeValue instead") this.thumbWidth, + this.thumbSizeValue, this.pinWidth, this.pinBorderWidth, this.pinDistance, this.shadowElevation, this.textStyle, }); + + PinStyle copyWith({ + bool? showShadow, + Color? pinColor, + Color? pinBorderColor, + Color? thumbColor, + Color? shadowColor, + double? arrowHeight, + double? arrowWidth, + double? thumbWidth, + double? thumbSizeValue, + double? pinWidth, + double? pinBorderWidth, + double? pinDistance, + double? shadowElevation, + TextStyle? textStyle, + }) { + return PinStyle( + showShadow: showShadow ?? this.showShadow, + pinColor: pinColor ?? this.pinColor, + pinBorderColor: pinBorderColor ?? this.pinBorderColor, + thumbColor: thumbColor ?? this.thumbColor, + shadowColor: shadowColor ?? this.shadowColor, + arrowHeight: arrowHeight ?? this.arrowHeight, + arrowWidth: arrowWidth ?? this.arrowWidth, + // ignore: deprecated_member_use_from_same_package + thumbWidth: thumbWidth ?? this.thumbWidth, + thumbSizeValue: thumbSizeValue ?? this.thumbSizeValue, + pinWidth: pinWidth ?? this.pinWidth, + pinBorderWidth: pinBorderWidth ?? this.pinBorderWidth, + pinDistance: pinDistance ?? this.pinDistance, + shadowElevation: shadowElevation ?? this.shadowElevation, + textStyle: textStyle ?? this.textStyle, + ); + } } diff --git a/lib/src/widgets/progress_pin/progress_pin.dart b/lib/src/widgets/progress_pin/progress_pin.dart index 2c952038..26bf444b 100644 --- a/lib/src/widgets/progress_pin/progress_pin.dart +++ b/lib/src/widgets/progress_pin/progress_pin.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:moon_design/src/theme/theme.dart'; +import 'package:moon_design/src/theme/tokens/sizes.dart'; import 'package:moon_design/src/theme/tokens/typography/typography.dart'; import 'package:moon_design/src/widgets/progress_pin/pin_style.dart'; import 'package:moon_design/src/widgets/progress_pin/progress_pin_painter.dart'; @@ -9,15 +10,15 @@ import 'package:moon_tokens/moon_tokens.dart'; class MoonProgressPin extends StatelessWidget { final double progressValue; final PinStyle? pinStyle; - final String progressLabel; + final String pinText; final Widget child; const MoonProgressPin({ super.key, required this.progressValue, - required this.child, this.pinStyle, - required this.progressLabel, + required this.pinText, + required this.child, }); @override @@ -28,7 +29,7 @@ class MoonProgressPin extends StatelessWidget { final Color effectivePinBorderColor = pinStyle?.pinBorderColor ?? context.moonTheme?.progressPinTheme.colors.pinBorderColor ?? MoonColors.light.goten; - final Color effectiveKnobColor = + final Color effectiveThumbColor = pinStyle?.thumbColor ?? context.moonTheme?.progressPinTheme.colors.thumbColor ?? MoonColors.light.goten; final Color effectiveShadowColor = @@ -39,19 +40,23 @@ class MoonProgressPin extends StatelessWidget { final TextStyle effectiveTextStyle = pinStyle?.textStyle ?? context.moonTheme?.progressPinTheme.properties.textStyle ?? - MoonTypography.typography.caption.text10.copyWith(letterSpacing: 0.5); - - final double effectiveKnobWidthMultiplier = - context.moonTheme?.progressPinTheme.properties.thumbWidthMultiplier ?? 1.5; + MoonTypography.typography.caption.text10; final double effectivePinWidth = pinStyle?.pinWidth ?? context.moonTheme?.progressPinTheme.properties.pinWidth ?? 36; - final double effectivePinBorderWidth = - pinStyle?.pinBorderWidth ?? context.moonTheme?.progressPinTheme.properties.pinBorderWidth ?? 2; + final double effectivePinBorderWidth = pinStyle?.pinBorderWidth ?? + context.moonTheme?.progressPinTheme.properties.pinBorderWidth ?? + MoonSizes.sizes.x6s; final double effectivePinDistance = - pinStyle?.pinDistance ?? context.moonTheme?.progressPinTheme.properties.pinDistance ?? 6; + pinStyle?.pinDistance ?? context.moonTheme?.progressPinTheme.properties.pinDistance ?? MoonSizes.sizes.x5s; + + final double effectiveArrowHeight = + pinStyle?.arrowHeight ?? context.moonTheme?.progressPinTheme.properties.arrowHeight ?? 6; + + final double effectiveArrowWidth = + pinStyle?.arrowWidth ?? context.moonTheme?.progressPinTheme.properties.arrowWidth ?? MoonSizes.sizes.x4s; final double effectiveShadowElevation = pinStyle?.shadowElevation ?? context.moonTheme?.progressPinTheme.properties.shadowElevation ?? 6; @@ -62,17 +67,19 @@ class MoonProgressPin extends StatelessWidget { foregroundPainter: ProgressPinPainter( showShadow: pinStyle?.showShadow ?? true, pinColor: effectivePinColor, - thumbColor: effectiveKnobColor, + thumbColor: effectiveThumbColor, shadowColor: effectiveShadowColor, pinBorderColor: effectivePinBorderColor, pinBorderWidth: effectivePinBorderWidth, + arrowHeight: effectiveArrowHeight, + arrowWidth: effectiveArrowWidth, pinDistance: effectivePinDistance, pinWidth: effectivePinWidth, - thumbWidth: pinStyle?.thumbWidth, - thumbWidthMultiplier: effectiveKnobWidthMultiplier, + // ignore: deprecated_member_use_from_same_package + thumbSizeValue: pinStyle?.thumbSizeValue ?? pinStyle?.thumbWidth, progressValue: progressValue, shadowElevation: effectiveShadowElevation, - labelText: progressLabel, + pinText: pinText, textDirection: effectiveTextDirection, textStyle: effectiveTextStyle.copyWith(color: effectiveTextColor), ), diff --git a/lib/src/widgets/progress_pin/progress_pin_painter.dart b/lib/src/widgets/progress_pin/progress_pin_painter.dart index 5d558f32..093f45fb 100644 --- a/lib/src/widgets/progress_pin/progress_pin_painter.dart +++ b/lib/src/widgets/progress_pin/progress_pin_painter.dart @@ -6,14 +6,15 @@ class ProgressPinPainter extends CustomPainter { final Color thumbColor; final Color shadowColor; final Color pinBorderColor; + final double arrowHeight; + final double arrowWidth; final double pinBorderWidth; final double pinDistance; final double pinWidth; - final double? thumbWidth; - final double thumbWidthMultiplier; + final double? thumbSizeValue; final double progressValue; final double shadowElevation; - final String labelText; + final String pinText; final TextStyle textStyle; final TextDirection textDirection; @@ -24,13 +25,14 @@ class ProgressPinPainter extends CustomPainter { required this.shadowColor, required this.pinBorderColor, required this.pinBorderWidth, + required this.arrowHeight, + required this.arrowWidth, required this.pinDistance, required this.pinWidth, - this.thumbWidth, - required this.thumbWidthMultiplier, + this.thumbSizeValue, required this.progressValue, required this.shadowElevation, - required this.labelText, + required this.pinText, required this.textStyle, required this.textDirection, }); @@ -38,10 +40,11 @@ class ProgressPinPainter extends CustomPainter { @override void paint(Canvas canvas, Size size) { final double radius = pinWidth / 2; - final double arrowHeight = radius / 3; - final double arrowWidth = radius / 2; - final double offsetY = -(radius + arrowHeight + pinDistance); - final double thumbSizeWidth = thumbWidth ?? size.height / thumbWidthMultiplier; + final double thumbRadius = switch (thumbSizeValue) { + _ when thumbSizeValue != null => thumbSizeValue! / 2, + _ => size.height / 2, + }; + final double offsetY = -(radius + arrowHeight + pinDistance) + (size.height / 2 - thumbRadius); // Offset based on directionality double offsetX = progressValue * size.width; @@ -62,9 +65,9 @@ class ProgressPinPainter extends CustomPainter { final Path path = Path() ..addOval(Rect.fromCircle(center: Offset(offsetX, offsetY), radius: radius)) ..addOval(Rect.fromCircle(center: Offset(offsetX, offsetY), radius: radius)) - ..moveTo(offsetX - arrowWidth / 2, offsetY + (radius * 0.9)) + ..moveTo(offsetX - arrowWidth / 2, offsetY + radius - 0.5) // shift the origin "up" by 0.5 to avoid aliasing ..lineTo(offsetX, offsetY + radius + arrowHeight) - ..lineTo(offsetX + arrowWidth / 2, offsetY + (radius * 0.9)) + ..lineTo(offsetX + arrowWidth / 2, offsetY + radius - 0.5) // shift the destination "up" by 0.5 to avoid aliasing ..close(); // Draw shadow around outer path @@ -77,16 +80,16 @@ class ProgressPinPainter extends CustomPainter { canvas.drawCircle(Offset(offsetX, offsetY), radius - pinBorderWidth, innerCirclePaint); // Draw thumb - canvas.drawCircle(Offset(offsetX, size.height / 2), thumbSizeWidth, thumbCirclePaint); + canvas.drawCircle(Offset(offsetX, size.height / 2), thumbRadius, thumbCirclePaint); - // Draw text - final TextPainter textPainter = TextPainter( - text: TextSpan(text: labelText, style: textStyle), - textDirection: TextDirection.ltr, + // Draw pin text + final TextPainter pinTextPainter = TextPainter( + text: TextSpan(text: pinText, style: textStyle), + textDirection: textDirection, ); - textPainter.layout(); - textPainter.paint(canvas, Offset(offsetX - textPainter.width / 2, offsetY - textPainter.height / 2)); + pinTextPainter.layout(); + pinTextPainter.paint(canvas, Offset(offsetX - pinTextPainter.width / 2, offsetY - pinTextPainter.height / 2)); } @override @@ -98,7 +101,7 @@ class ProgressPinPainter extends CustomPainter { oldPainter.pinBorderColor != pinBorderColor || oldPainter.pinDistance != pinDistance || oldPainter.thumbColor != thumbColor || - oldPainter.thumbWidth != thumbWidth || + oldPainter.thumbSizeValue != thumbSizeValue || oldPainter.showShadow != showShadow || oldPainter.shadowColor != shadowColor || oldPainter.shadowElevation != shadowElevation || From c39b3e9c0880239410b18ede61fadafee0aebf8d Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 5 Feb 2024 12:38:21 +0200 Subject: [PATCH 2/2] chore(main): release 0.47.1 (#343) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- .release-please-manifest.json | 2 +- CHANGELOG.md | 7 +++++++ example/pubspec.yaml | 2 +- pubspec.yaml | 2 +- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 141e7cde..cd2f5a32 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.47.0" + ".": "0.47.1" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 399ede92..afd2aaec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [0.47.1](https://github.com/coingaming/moon_flutter/compare/v0.47.0...v0.47.1) (2024-02-05) + + +### Bug Fixes + +* [MDS-984] Update LinearProgress according to design ([#342](https://github.com/coingaming/moon_flutter/issues/342)) ([2294a0b](https://github.com/coingaming/moon_flutter/commit/2294a0b147f11b785d303f35e854dd0462ff995e)) + ## [0.47.0](https://github.com/coingaming/moon_flutter/compare/v0.46.0...v0.47.0) (2024-01-19) diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 349f6393..eb2dd54d 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -1,7 +1,7 @@ name: example description: Showcase Moon Design. publish_to: none -version: 0.47.0 +version: 0.47.1 environment: sdk: '>=3.1.2 <4.0.0' dependencies: diff --git a/pubspec.yaml b/pubspec.yaml index 29d7b642..28ceae06 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: moon_design description: Moon Design System for Flutter. A set of coherent, themable, and extensible widgets following the Moon Design System. -version: 0.47.0 +version: 0.47.1 homepage: https://flutter.moon.io/ repository: https://github.com/coingaming/moon_flutter