Skip to content

Commit 8dae9eb

Browse files
FLUT-931209-[others]: updated gauges latest changes
1 parent 92b48f5 commit 8dae9eb

File tree

12 files changed

+26
-71
lines changed

12 files changed

+26
-71
lines changed

packages/syncfusion_flutter_gauges/CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
## [28.1.29] - 12/12/2024
1+
## [28.1.36] - 12/24/2024
2+
3+
**General**
4+
5+
* The compatible version of our Flutter gauges widget has been updated to Flutter SDK 3.27.0.
6+
7+
## [28.1.33] - 12/12/2024
28

39
**General**
410

packages/syncfusion_flutter_gauges/lib/src/linear_gauge/axis/linear_axis_renderer.dart

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ class RenderLinearAxis extends RenderBox {
228228
_factorToValueCallback = factorToValueCallback,
229229
_valueToFactorCallback = valueToFactorCallback {
230230
_axisPaint = Paint()
231-
..color = Theme.of(context).colorScheme.onSurface.withOpacity(0.12);
231+
..color = Theme.of(context).colorScheme.onSurface.withValues(alpha: 0.12);
232232
_textPainter = TextPainter(textDirection: TextDirection.ltr);
233233
_visibleLabels = <LinearAxisLabel>[];
234234
_isHorizontalOrientation = orientation == LinearGaugeOrientation.horizontal;
@@ -890,9 +890,6 @@ class RenderLinearAxis extends RenderBox {
890890
((axisSize < tickSize) ? tickSize - axisSize : 0.0) +
891891
labelSize;
892892
break;
893-
// ignore: no_default_cases
894-
default:
895-
break;
896893
}
897894

898895
return _axisWidgetThickness;
@@ -926,9 +923,6 @@ class RenderLinearAxis extends RenderBox {
926923
? labelSize + labelMarginSize + axisSize + tickMarginSize
927924
: 0;
928925
break;
929-
// ignore: no_default_cases
930-
default:
931-
break;
932926
}
933927
break;
934928
case LinearElementPosition.outside:
@@ -953,9 +947,6 @@ class RenderLinearAxis extends RenderBox {
953947
axisOffset += tickMarginSize - (labelSize + labelMarginSize);
954948
}
955949
break;
956-
// ignore: no_default_cases
957-
default:
958-
break;
959950
}
960951
break;
961952
case LinearElementPosition.cross:
@@ -996,14 +987,8 @@ class RenderLinearAxis extends RenderBox {
996987
_tickTop = showTicks ? labelSize + labelMarginSize : 0;
997988
}
998989
break;
999-
// ignore: no_default_cases
1000-
default:
1001-
break;
1002990
}
1003991
break;
1004-
// ignore: no_default_cases
1005-
default:
1006-
break;
1007992
}
1008993
}
1009994

@@ -1358,7 +1343,7 @@ class RenderLinearAxis extends RenderBox {
13581343
}
13591344

13601345
_axisPaint.color =
1361-
paintColor.withOpacity(animationValue * paintColor.opacity);
1346+
paintColor.withValues(alpha: animationValue * paintColor.a);
13621347
}
13631348

13641349
///Draws minor tick elements.
@@ -1426,7 +1411,7 @@ class RenderLinearAxis extends RenderBox {
14261411
}
14271412

14281413
if (color != null) {
1429-
color = color.withOpacity(animationValue * color.opacity);
1414+
color = color.withValues(alpha: animationValue * color.a);
14301415
}
14311416

14321417
return dart_ui.TextStyle(
@@ -1565,9 +1550,6 @@ class RenderLinearAxis extends RenderBox {
15651550
rect: _axisLineRect,
15661551
radius: thickness / 2));
15671552
break;
1568-
// ignore: no_default_cases
1569-
default:
1570-
break;
15711553
}
15721554

15731555
canvas.drawPath(_path, _axisPaint);

packages/syncfusion_flutter_gauges/lib/src/linear_gauge/gauge/linear_gauge_render_widget.dart

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -311,9 +311,6 @@ class RenderLinearGauge extends RenderBox
311311
(axisLineSize < tickSize ? (tickSize - axisLineSize) / 2 : 0);
312312
}
313313
break;
314-
// ignore: no_default_cases
315-
default:
316-
break;
317314
}
318315

319316
_insideWidgetElementSize =
@@ -409,9 +406,6 @@ class RenderLinearGauge extends RenderBox
409406
}
410407
}
411408
break;
412-
// ignore: no_default_cases
413-
default:
414-
break;
415409
}
416410
}
417411

@@ -435,9 +429,6 @@ class RenderLinearGauge extends RenderBox
435429
case LinearElementPosition.cross:
436430
_measureCrossElementSize(thickness);
437431
break;
438-
// ignore: no_default_cases
439-
default:
440-
break;
441432
}
442433
}
443434

@@ -485,12 +476,7 @@ class RenderLinearGauge extends RenderBox
485476
return _outsideWidgetElementSize +
486477
_getCrossElementPosition(markerSize) +
487478
(_actualSizeDelta! / 2);
488-
// ignore: no_default_cases
489-
default:
490-
break;
491479
}
492-
493-
return null;
494480
}
495481

496482
double _getCrossElementPosition(double width) {
@@ -674,9 +660,6 @@ class RenderLinearGauge extends RenderBox
674660
case LinearElementPosition.cross:
675661
_measureCrossElementSize(rangeThickness);
676662
break;
677-
// ignore: no_default_cases
678-
default:
679-
break;
680663
}
681664
}
682665
}
@@ -792,9 +775,6 @@ class RenderLinearGauge extends RenderBox
792775
(_actualSizeDelta! / 2) +
793776
_getCrossElementPosition(thickness);
794777
break;
795-
// ignore: no_default_cases
796-
default:
797-
break;
798778
}
799779

800780
_positionChildElement(range, thickness: rangeWidth);
@@ -837,9 +817,6 @@ class RenderLinearGauge extends RenderBox
837817
(_actualSizeDelta! / 2) +
838818
_getCrossElementPosition(barPointer.thickness);
839819
break;
840-
// ignore: no_default_cases
841-
default:
842-
break;
843820
}
844821

845822
_positionChildElement(barPointer, thickness: barWidth);

packages/syncfusion_flutter_gauges/lib/src/linear_gauge/pointers/linear_bar_renderer.dart

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -392,9 +392,6 @@ class RenderLinearBarPointer extends RenderOpacity {
392392
rect: _barRect,
393393
radius: thickness / 2));
394394
break;
395-
// ignore: no_default_cases
396-
default:
397-
break;
398395
}
399396

400397
return _path;

packages/syncfusion_flutter_gauges/lib/src/linear_gauge/pointers/linear_shape_pointer.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -446,8 +446,8 @@ class LinearShapePointer extends LeafRenderObjectWidget
446446
final Color shapePointerColor = isMaterial3
447447
? theme.colorScheme.onSurfaceVariant
448448
: isDarkTheme
449-
? theme.colorScheme.onSurface.withOpacity(0.70)
450-
: theme.colorScheme.onSurface.withOpacity(0.54);
449+
? theme.colorScheme.onSurface.withValues(alpha: 0.70)
450+
: theme.colorScheme.onSurface.withValues(alpha: 0.54);
451451
return RenderLinearShapePointer(
452452
value: value,
453453
onChanged: onChanged,
@@ -484,8 +484,8 @@ class LinearShapePointer extends LeafRenderObjectWidget
484484
final Color shapePointerColor = isMaterial3
485485
? theme.colorScheme.onSurfaceVariant
486486
: isDarkTheme
487-
? theme.colorScheme.onSurface.withOpacity(0.70)
488-
: theme.colorScheme.onSurface.withOpacity(0.54);
487+
? theme.colorScheme.onSurface.withValues(alpha: 0.70)
488+
: theme.colorScheme.onSurface.withValues(alpha: 0.54);
489489

490490
renderObject
491491
..value = value

packages/syncfusion_flutter_gauges/lib/src/linear_gauge/pointers/linear_shape_renderer.dart

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -297,9 +297,6 @@ class RenderLinearShapePointer extends RenderLinearPointerBase {
297297
case LinearShapePointerType.diamond:
298298
markerType = core.ShapeMarkerType.diamond;
299299
break;
300-
// ignore: no_default_cases
301-
default:
302-
break;
303300
}
304301

305302
core.paint(

packages/syncfusion_flutter_gauges/lib/src/linear_gauge/range/linear_gauge_range_renderer.dart

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -421,9 +421,6 @@ class RenderLinearRange extends RenderOpacity {
421421
rect: rangeRect,
422422
radius: startThickness / 2));
423423
break;
424-
// ignore: no_default_cases
425-
default:
426-
break;
427424
}
428425
} else {
429426
_drawRangeStyle(_path);
@@ -439,7 +436,7 @@ class RenderLinearRange extends RenderOpacity {
439436
animationValue = _rangeAnimation!.value;
440437
}
441438

442-
_rangePaint.color = color.withOpacity(animationValue * color.opacity);
439+
_rangePaint.color = color.withValues(alpha: animationValue * color.a);
443440
_path.reset();
444441
_getRangePath();
445442
canvas.drawPath(_path, _rangePaint);

packages/syncfusion_flutter_gauges/lib/src/linear_gauge/utils/linear_gauge_helper.dart

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,6 @@ Curve getCurveAnimation(LinearAnimationType type) {
108108
case LinearAnimationType.slowMiddle:
109109
curve = Curves.slowMiddle;
110110
break;
111-
// ignore: no_default_cases
112-
default:
113-
break;
114111
}
115112
return curve;
116113
}

packages/syncfusion_flutter_gauges/lib/src/radial_gauge/pointers/marker_pointer_renderer.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -660,9 +660,9 @@ class RenderMarkerPointer extends RenderBox {
660660
overlayColor != colorScheme.transparent) {
661661
overlayPaint = Paint()
662662
..color = overlayColor ??
663-
color?.withOpacity(0.12) ??
664-
gaugeThemeData.markerColor?.withOpacity(0.12) ??
665-
_themeData.colorScheme.secondaryContainer.withOpacity(0.12)
663+
color?.withValues(alpha: 0.12) ??
664+
gaugeThemeData.markerColor?.withValues(alpha: 0.12) ??
665+
_themeData.colorScheme.secondaryContainer.withValues(alpha: 0.12)
666666
..style = PaintingStyle.fill;
667667
}
668668

packages/syncfusion_flutter_gauges/lib/src/radial_gauge/pointers/range_pointer_renderer.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ class RenderRangePointer extends RenderBox {
580580
(_themeData.useMaterial3
581581
? _themeData.colorScheme.primary
582582
: _themeData.colorScheme.secondaryContainer)
583-
.withOpacity(0.8)
583+
.withValues(alpha: 0.8)
584584
..strokeWidth = _actualRangeThickness
585585
..style = isFill ? PaintingStyle.fill : PaintingStyle.stroke;
586586

packages/syncfusion_flutter_gauges/lib/src/radial_gauge/range/gauge_range_renderer.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -633,8 +633,8 @@ class RenderGaugeRange extends RenderBox {
633633
..style = isFill ? PaintingStyle.fill : PaintingStyle.stroke
634634
..strokeWidth = strokeWidth
635635
..color = color ?? _gaugeThemeData.rangeColor ?? const Color(0xFFF67280);
636-
final double actualOpacity = paint.color.opacity;
637-
paint.color = paint.color.withOpacity(opacity * actualOpacity);
636+
final double actualOpacity = paint.color.a;
637+
paint.color = paint.color.withValues(alpha: opacity * actualOpacity);
638638
if (gradient != null && gradient!.colors.isNotEmpty) {
639639
List<Color> colors = gradient!.colors;
640640
if (axisRenderer!.isInversed) {
@@ -697,11 +697,11 @@ class RenderGaugeRange extends RenderBox {
697697
final Color rangeColor =
698698
color ?? _gaugeThemeData.rangeColor ?? const Color(0xFFF67280);
699699
final Color labelColor = labelStyle.color ?? getSaturationColor(rangeColor);
700-
final double actualOpacity = labelColor.opacity;
700+
final double actualOpacity = labelColor.a;
701701
final TextSpan span = TextSpan(
702702
text: label,
703703
style: TextStyle(
704-
color: labelColor.withOpacity(actualOpacity * opacity),
704+
color: labelColor.withValues(alpha: actualOpacity * opacity),
705705
fontSize: labelStyle.fontSize,
706706
fontFamily: labelStyle.fontFamily,
707707
fontStyle: labelStyle.fontStyle,

packages/syncfusion_flutter_gauges/lib/src/radial_gauge/utils/helper.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ Offset getDegreeToPoint(double degree, double radius, Offset center) {
5050
/// Methods to get the saturation color
5151
Color getSaturationColor(Color color) {
5252
final num contrast =
53-
((color.red * 299 + color.green * 587 + color.blue * 114) / 1000).round();
53+
(((color.r * 255) * 299 + (color.g * 255) * 587 + (color.b * 255) * 114) /
54+
1000)
55+
.round();
5456
final Color saturationColor =
5557
contrast >= 128 ? const Color(0xFF333333) : const Color(0xFFF5F5F5);
5658
return saturationColor;

0 commit comments

Comments
 (0)