Skip to content

Commit 290af04

Browse files
committed
format code
Signed-off-by: huycozy <huy@nevercode.io>
1 parent 67687f2 commit 290af04

File tree

1 file changed

+42
-49
lines changed

1 file changed

+42
-49
lines changed

packages/flutter/lib/src/material/slider_parts.dart

Lines changed: 42 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,9 @@ mixin BaseSliderTrackShape {
227227
bool isDiscrete = false,
228228
}) {
229229
final double thumbWidth = sliderTheme.thumbShape!.getPreferredSize(isEnabled, isDiscrete).width;
230-
final double overlayWidth =
231-
sliderTheme.overlayShape!.getPreferredSize(isEnabled, isDiscrete).width;
230+
final double overlayWidth = sliderTheme.overlayShape!
231+
.getPreferredSize(isEnabled, isDiscrete)
232+
.width;
232233
double trackHeight = sliderTheme.trackHeight!;
233234
assert(overlayWidth >= 0);
234235
assert(trackHeight >= 0);
@@ -372,8 +373,8 @@ class RectangularSliderTrackShape extends SliderTrackShape with BaseSliderTrackS
372373
begin: sliderTheme.disabledSecondaryActiveTrackColor,
373374
end: sliderTheme.secondaryActiveTrackColor,
374375
);
375-
final Paint secondaryTrackPaint =
376-
Paint()..color = secondaryTrackColorTween.evaluate(enableAnimation)!;
376+
final Paint secondaryTrackPaint = Paint()
377+
..color = secondaryTrackColorTween.evaluate(enableAnimation)!;
377378
final Rect secondaryTrackSegment = switch (textDirection) {
378379
TextDirection.rtl => Rect.fromLTRB(
379380
secondaryOffset.dx,
@@ -520,8 +521,8 @@ class RoundedRectSliderTrackShape extends SliderTrackShape with BaseSliderTrackS
520521
begin: sliderTheme.disabledSecondaryActiveTrackColor,
521522
end: sliderTheme.secondaryActiveTrackColor,
522523
);
523-
final Paint secondaryTrackPaint =
524-
Paint()..color = secondaryTrackColorTween.evaluate(enableAnimation)!;
524+
final Paint secondaryTrackPaint = Paint()
525+
..color = secondaryTrackColorTween.evaluate(enableAnimation)!;
525526
if (isLTR) {
526527
context.canvas.drawRRect(
527528
RRect.fromLTRBAndCorners(
@@ -624,8 +625,8 @@ class RoundSliderTickMarkShape extends SliderTickMarkShape {
624625
sliderTheme.activeTickMarkColor,
625626
),
626627
};
627-
final Paint paint =
628-
Paint()..color = ColorTween(begin: begin, end: end).evaluate(enableAnimation)!;
628+
final Paint paint = Paint()
629+
..color = ColorTween(begin: begin, end: end).evaluate(enableAnimation)!;
629630

630631
// The tick marks are tiny circles that are the same height as the track.
631632
final double tickMarkRadius =
@@ -752,12 +753,12 @@ class RoundSliderThumbShape extends SliderComponentShape {
752753
final Tween<double> elevationTween = Tween<double>(begin: elevation, end: pressedElevation);
753754

754755
final double evaluatedElevation = elevationTween.evaluate(activationAnimation);
755-
final Path path =
756-
Path()..addArc(
757-
Rect.fromCenter(center: center, width: 2 * radius, height: 2 * radius),
758-
0,
759-
math.pi * 2,
760-
);
756+
final Path path = Path()
757+
..addArc(
758+
Rect.fromCenter(center: center, width: 2 * radius, height: 2 * radius),
759+
0,
760+
math.pi * 2,
761+
);
761762

762763
bool paintShadows = true;
763764
assert(() {
@@ -1021,11 +1022,10 @@ class _DropSliderValueIndicatorPathPainter {
10211022
final RRect borderRect = adjustedBorderRadius
10221023
.resolve(labelPainter.textDirection)
10231024
.toRRect(upperRect);
1024-
final Path trianglePath =
1025-
Path()
1026-
..lineTo(-_triangleHeight, -_triangleHeight)
1027-
..lineTo(_triangleHeight, -_triangleHeight)
1028-
..close();
1025+
final Path trianglePath = Path()
1026+
..lineTo(-_triangleHeight, -_triangleHeight)
1027+
..lineTo(_triangleHeight, -_triangleHeight)
1028+
..close();
10291029
trianglePath.addRRect(borderRect);
10301030
final Path path;
10311031
if (hasMultipleLines) {
@@ -1090,20 +1090,18 @@ class _DropSliderValueIndicatorPathPainter {
10901090
final RRect borderRect = adjustedBorderRadius
10911091
.resolve(labelPainter.textDirection)
10921092
.toRRect(upperRect);
1093-
path =
1094-
Path()
1095-
..lineTo(-_triangleHeight, -_triangleHeight)
1096-
..lineTo(_triangleHeight, -_triangleHeight)
1097-
..close();
1093+
path = Path()
1094+
..lineTo(-_triangleHeight, -_triangleHeight)
1095+
..lineTo(_triangleHeight, -_triangleHeight)
1096+
..close();
10981097
path.addRRect(borderRect);
10991098
}
11001099

11011100
if (strokePaintColor != null) {
1102-
final Paint strokePaint =
1103-
Paint()
1104-
..color = strokePaintColor
1105-
..strokeWidth = 1.0
1106-
..style = PaintingStyle.stroke;
1101+
final Paint strokePaint = Paint()
1102+
..color = strokePaintColor
1103+
..strokeWidth = 1.0
1104+
..style = PaintingStyle.stroke;
11071105
canvas.drawPath(trianglePath, strokePaint);
11081106
canvas.drawPath(path, strokePaint);
11091107
}
@@ -1193,8 +1191,9 @@ class HandleThumbShape extends SliderComponentShape {
11931191
final Color color = colorTween.evaluate(enableAnimation)!;
11941192

11951193
final Canvas canvas = context.canvas;
1196-
final Size thumbSize =
1197-
sliderTheme.thumbSize!.resolve(<MaterialState>{})!; // This is resolved in the paint method.
1194+
final Size thumbSize = sliderTheme.thumbSize!.resolve(
1195+
<MaterialState>{},
1196+
)!; // This is resolved in the paint method.
11981197
final RRect rrect = RRect.fromRectAndRadius(
11991198
Rect.fromCenter(center: center, width: thumbSize.width, height: thumbSize.height),
12001199
Radius.circular(thumbSize.shortestSide / 2),
@@ -1352,8 +1351,8 @@ class GappedSliderTrackShape extends SliderTrackShape with BaseSliderTrackShape
13521351
begin: sliderTheme.disabledSecondaryActiveTrackColor,
13531352
end: sliderTheme.secondaryActiveTrackColor,
13541353
);
1355-
final Paint secondaryTrackPaint =
1356-
Paint()..color = secondaryTrackColorTween.evaluate(enableAnimation)!;
1354+
final Paint secondaryTrackPaint = Paint()
1355+
..color = secondaryTrackColorTween.evaluate(enableAnimation)!;
13571356
if (isLTR) {
13581357
context.canvas.drawRRect(
13591358
RRect.fromLTRBAndCorners(
@@ -1395,10 +1394,9 @@ class GappedSliderTrackShape extends SliderTrackShape with BaseSliderTrackShape
13951394
trackRect.center.dy,
13961395
);
13971396

1398-
final bool showStopIndicator =
1399-
(textDirection == TextDirection.ltr)
1400-
? thumbCenter.dx < stopIndicatorOffset.dx
1401-
: thumbCenter.dx > stopIndicatorOffset.dx;
1397+
final bool showStopIndicator = (textDirection == TextDirection.ltr)
1398+
? thumbCenter.dx < stopIndicatorOffset.dx
1399+
: thumbCenter.dx > stopIndicatorOffset.dx;
14021400
if (showStopIndicator && !isDiscrete) {
14031401
final Rect stopIndicatorRect = Rect.fromCircle(
14041402
center: stopIndicatorOffset,
@@ -1616,13 +1614,9 @@ class _RoundedRectSliderValueIndicatorPathPainter {
16161614

16171615
final bool hasMultipleLines = multilineConfig.enabled && labelText.contains('\n');
16181616
final double cornerPadding = multilineConfig.cornerPadding ?? _multilineCornerPadding;
1619-
final double rectHeight =
1620-
hasMultipleLines
1621-
? math.max(
1622-
_preferredHeight,
1623-
finalLabelPainter.height + (_labelPadding * 2) + cornerPadding,
1624-
)
1625-
: _preferredHeight * textScaleFactor;
1617+
final double rectHeight = hasMultipleLines
1618+
? math.max(_preferredHeight, finalLabelPainter.height + (_labelPadding * 2) + cornerPadding)
1619+
: _preferredHeight * textScaleFactor;
16261620

16271621
// The rectangle which is above the thumb, with no triangle)
16281622
final Rect upperRect = Rect.fromLTWH(
@@ -1643,11 +1637,10 @@ class _RoundedRectSliderValueIndicatorPathPainter {
16431637
canvas.drawRRect(rrect, fillPaint);
16441638

16451639
if (strokePaintColor != null) {
1646-
final Paint strokePaint =
1647-
Paint()
1648-
..color = strokePaintColor
1649-
..strokeWidth = 1.0
1650-
..style = PaintingStyle.stroke;
1640+
final Paint strokePaint = Paint()
1641+
..color = strokePaintColor
1642+
..strokeWidth = 1.0
1643+
..style = PaintingStyle.stroke;
16511644
canvas.drawRRect(rrect, strokePaint);
16521645
}
16531646

0 commit comments

Comments
 (0)