Skip to content

Commit f19164e

Browse files
committed
First try to smoothen out drag start (rvamsikrishna#9)
1 parent 66eb38e commit f19164e

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

lib/flutter_fluid_slider.dart

+13-13
Original file line numberDiff line numberDiff line change
@@ -167,12 +167,12 @@ class _FluidSliderState extends State<FluidSlider>
167167
//The radius of the slider thumb control
168168
thumbDiameter = widget.thumbDiameter ?? 60.0;
169169
_animationController = AnimationController(
170-
duration: Duration(milliseconds: 400),
170+
duration: Duration(milliseconds: 200),
171171
vsync: this,
172172
);
173173

174174
_thumbAnimation = CurvedAnimation(
175-
curve: Curves.bounceOut,
175+
curve: Curves.easeOut,
176176
parent: _animationController,
177177
);
178178
}
@@ -288,13 +288,13 @@ class _FluidSliderState extends State<FluidSlider>
288288
TextStyle _currentValTextStyle(BuildContext context) {
289289
final TextStyle defaultStyle = widget.showDecimalValue
290290
? Theme.of(context)
291-
.textTheme
292-
.subhead
293-
.copyWith(fontWeight: FontWeight.bold)
291+
.textTheme
292+
.subhead
293+
.copyWith(fontWeight: FontWeight.bold)
294294
: Theme.of(context)
295-
.textTheme
296-
.title
297-
.copyWith(fontWeight: FontWeight.bold);
295+
.textTheme
296+
.title
297+
.copyWith(fontWeight: FontWeight.bold);
298298

299299
return widget.valueTextStyle ?? defaultStyle;
300300
}
@@ -313,18 +313,18 @@ class _FluidSliderState extends State<FluidSlider>
313313
//This is used to compute the thumb position and also
314314
//calculate the delta drag value in the horizontal drag handlers.
315315
_sliderWidth =
316-
constraints.hasBoundedWidth ? constraints.maxWidth : 200.0;
316+
constraints.hasBoundedWidth ? constraints.maxWidth : 200.0;
317317

318318
//The width remaining for the thumb to be dragged upto.
319319
remainingWidth = _sliderWidth - thumbDiameter - 2 * thumbPadding;
320320

321321
//The position of the thumb control of the slider from max value.
322322
final double thumbPositionLeft =
323-
lerpDouble(thumbPadding, remainingWidth, thumbPosFactor);
323+
lerpDouble(thumbPadding, remainingWidth, thumbPosFactor);
324324

325325
//The position of the thumb control of the slider from min value.
326326
final double thumbPositionRight =
327-
lerpDouble(remainingWidth, thumbPadding, thumbPosFactor);
327+
lerpDouble(remainingWidth, thumbPadding, thumbPosFactor);
328328

329329
//Start position of slider thumb.
330330
final RelativeRect beginRect = RelativeRect.fromLTRB(
@@ -403,8 +403,8 @@ class _FluidSliderState extends State<FluidSlider>
403403
widget.mapValueToString != null
404404
? widget.mapValueToString(widget.value)
405405
: widget.showDecimalValue
406-
? widget.value.toStringAsFixed(1)
407-
: widget.value.toInt().toString(),
406+
? widget.value.toStringAsFixed(1)
407+
: widget.value.toInt().toString(),
408408
style: _currentValTextStyle(context),
409409
),
410410
),

0 commit comments

Comments
 (0)