Skip to content

Commit

Permalink
Update slider.dart
Browse files Browse the repository at this point in the history
fix #1038
  • Loading branch information
dev-aniketj committed Mar 23, 2024
1 parent ed77764 commit 37f3baf
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/src/controls/inputs/slider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,8 @@ class _SliderState extends State<Slider> {

/// This is used to remove the padding the Material Slider adds automatically
class _CustomTrackShape extends m.RoundedRectSliderTrackShape {
static const double _trackSidePadding = 10.0;

@override
Rect getPreferredRect({
required RenderBox parentBox,
Expand All @@ -391,9 +393,9 @@ class _CustomTrackShape extends m.RoundedRectSliderTrackShape {
bool isDiscrete = false,
}) {
final trackHeight = sliderTheme.trackHeight!;
final trackLeft = offset.dx;
final trackLeft = offset.dx + _trackSidePadding;
final trackTop = offset.dy + (parentBox.size.height - trackHeight) / 2;
final trackWidth = parentBox.size.width;
final trackWidth = parentBox.size.width - (2 * _trackSidePadding);
return Rect.fromLTWH(trackLeft, trackTop, trackWidth, trackHeight);
}

Expand Down

0 comments on commit 37f3baf

Please sign in to comment.